I've read several links about this but haven't been able to find something that addresses my situation.
Here's my directory structure:
- app
- __init.py
- main.py
- foo
- __init.py
- foo_library.py
- bar
- __init.py
- bar_library.py
My application starts in main.py
which in turn imports / calls all the other files.
However, it seems that I must import all files relative to main.py
.
E.g inside foo/foo_library
, if I want to import bar/bar_library
, then I can't do from ..bar import bar_library
, or import app.bar.bar_library
.
Instead I must do import bar.bar_library.py
- i.e the path that would work if I was importing it from main.py
instead of foo/foo_library.py
.
Is there any way to use import app.bar.bar_library
or from ..bar import bar_library
?