Created
January 15, 2022 14:23
-
-
Save RahulDas-dev/512761b05abf3851dfc7c1f323e19bc0 to your computer and use it in GitHub Desktop.
Jupyter notebook import relative module from parent folder
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import os | |
import sys | |
import inspect | |
currentdir = os.path.dirname(os.path.abspath(inspect.getfile(inspect.currentframe()))) | |
#print(currentdir) | |
parentdir = os.path.dirname(currentdir) | |
lib_path = os.path.join(parentdir,'src') | |
#print(parentdir, lib_path) | |
sys.path.insert(0,lib_path) | |
# ---then import library | |
import mycode |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment