This is my directory structure:
scripts/
bpydata/
bpymodules/
myCustomScripts/
lib/
__init__.py
customLib.py
plugin/
__init__.py
myParser.py
__init__.py
runner.py
...
my_import_script.py
...
I start with my_import_script, which will import the myCustomScripts package.
From there, I import runner, which will import myParser.
myParser requires something that is defined in customLib, so it will use relative import to get it as such
from .lib import customLib
But it doesn’t work because I started with my_import_script so it will search its parent directory rather than search myParser’s parent directory.
When myParser wants .lib, how can I make sure that I am stepping up one directory from myParser’s directory rather than my_import_script’s directory?
To import from a parent package use
... If I’m not misunderstanding you, this should work:See http://docs.python.org/tutorial/modules.html.