Last active
March 12, 2023 13:15
-
-
Save reservoirinvest/289c282be234ed5903c916766541c90c to your computer and use it in GitHub Desktop.
jupyter notebook hack within vscode to import modules from parent
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
# needed for Jupyter notebooks | |
import os | |
from pathlib import Path | |
if Path.cwd().parts[-1] == 'notebooks': | |
root = Path.cwd().parent | |
else: | |
root = Path.cwd() | |
os.chdir(root) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment