If I'm in a notebook thats stored in its own sub-dir, how can I call a function in the parent dir, or alternatively in an adjacent sub-dir (with both being within the parent directory)?
My directory structure is as follows:
main_dir/
└─ __init__.py
└─ main.py
└─ my_funcs.py
└─ sub_dir/
└─demo.ipynb
When I try to run from main_dir.my_funcs import func_name
from the demo notebook I get ModuleNotFoundError: No module named 'main_dir'
. But when I run it from main.py
it works correctly.
I had assumed that the __init__.py
would mean that the notebook would automatically search and find my_funcs.py
but it seems I've missed something.