Skip to content

Instantly share code, notes, and snippets.

@reservoirinvest
Last active March 12, 2023 13:15
Show Gist options
  • Save reservoirinvest/289c282be234ed5903c916766541c90c to your computer and use it in GitHub Desktop.
Save reservoirinvest/289c282be234ed5903c916766541c90c to your computer and use it in GitHub Desktop.
jupyter notebook hack within vscode to import modules from parent
# 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