I have structured my python project on Windows so that Juypter notebooks are in there own folder.
The paths are like this:
\src\tracker\timer.py
\notebooks\notebook_files.nypyb
My import statement in the notebook_file used to look like:
from timer import Timer
But now this fails with import could not be resolved.
I have tried various combinations to pass the full path (up one folder and down /src/tracker)
from ../src/tracker.timer import Timer
from ..src/tracker.timer import Timer
But neither of these work. How can I get the import to be resolved?
>Solution :
import statements do not refer to directory paths, but module paths. If you add \src to your PYTHONPATH (or sys.path) you can from tracker.timer import Timer (assuming, that is, that \src\tracker\__init__.py exists so tracker is a valid package)