I am running Python 2.5.
This is my folder tree:
ptdraft/
nib.py
simulations/
life/
life.py
(I also have __init__.py
in each folder, omitted here for readability)
How do I import the nib
module from inside the life
module? I am hoping it is possible to do without tinkering with sys.path.
Note: The main module being run is in the ptdraft
folder.
Answer
It seems that the problem is not related to the module being in a parent directory or anything like that.
You need to add the directory that contains ptdraft
to PYTHONPATH
You said that import nib
worked with you, that probably means that you added ptdraft
itself (not its parent) to PYTHONPATH.
No comments:
Post a Comment