Created
July 16, 2025 16:56
-
-
Save antonioshadji/82f79f3ccda194c6a9d927819e43a09a to your computer and use it in GitHub Desktop.
managing sys.path with files is different folders within a project
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
# Folder paths are | |
# project-root/ | |
# ├── notebooks/ | |
# │ └── my_notebook.ipynb | |
# └── sami/ | |
# ├── __init__.py # (recommended) | |
# └── my_module.py | |
import sys | |
import os | |
from pathlib import Path | |
print(sys.path) | |
pwd = %pwd | |
# from notebook import get_timeframes only works with this (? also requires project root?) | |
# p = str(Path(pwd).parent / "sami") | |
# if p not in sys.path: | |
# sys.path.insert(0,p) | |
root = str(Path(pwd).parent) | |
if root not in sys.path: | |
sys.path.insert(0,root) | |
print(sys.path) | |
from sami.notebook import load_data |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment