I have a workspace with different projects as shown below.
I have a code in my main_scripts.py which is under main_scripts sub folder that needs to call a function inside the file config_reader.py which is inside the folder user_functions.
testing_framework is my current working directory with pyspark_training as my root project.
My main_script.py looks like this
and my config_reader.py file like this:
I tried to create a dev.env file into the main pyspark_training folder:

and also i tried modifying the setting for pyspark_training but i am not too sure whether this is correct.
But still getting : ModuleNotFoundError: No module named 'user_functions'
can anyone help me to solve this? I have gone through a bunch of stack verflow topics covering the issue but to no use. I am still getting the same error.




/full/path/to/testing_frameworktosys.pathbefore importing anything fromuser_functionsBASE = os.path.dirname(os.path.abspath(__file__))to get folder in which you have this script, and later create path to..-parent_folder = os.path.join(BASE, "..")(eventually withos.path.abspath()) and later addparent_foldertosys.path. All because IDE (like VSCode) may run your script with differentCurrent Working Directoryand using only..may mean different place as you expect. You could useprint( os.getcwd() )to checkCurrent Working Directory.