With a folder structure such as:
meta_project
libs
__init__.py
module.py
notebook_folder
notebook.jpynb
If you want to import module.py
from notebook.jpynb
, you can use the following code:
import os
import sys
module_path = os.path.abspath(os.path.join('..'))
if module_path not in sys.path:
sys.path.append(module_path)
from libs import module