Possible Duplicate:
Python package structure
Hello,
I’m looking to import a python file that I have in a sub-directory that is below the root of my main file. e.g.
import ../library/utils.py
When I put that into my code and run it I get a compile error.
Is there a way to include files from below the main file root directory or does it have to be in a sub-directory in the root?
Thanks for your help.
This will modify the sys.path variable that contains the directories to search for files. It will also make sure that it will find it properly even if you run it as:
This will work for stuff under development, testing, training. Installed files will not need such a construct.