Given this directory structure
project
├── utils
│ └── module.py
└── notebooks
└── notebook.ipynb
and that you want to import module.py in notebook.ipynb. Add the directory path to the notebook like so,
import os, sys
directory_path = os.path.abspath(os.path.join('..'))
if directory_path not in sys.path:
sys.path.append(directory_path)
And then from within notebook.ipynb you can import module.py like so:
from utils.module import my_func
This address the issue of ImportError: attempted relative import with no known parent package found when running notebooks.
Ref: