Skip to content

Instantly share code, notes, and snippets.

@antonioshadji
Created July 16, 2025 16:56
Show Gist options
  • Save antonioshadji/82f79f3ccda194c6a9d927819e43a09a to your computer and use it in GitHub Desktop.
Save antonioshadji/82f79f3ccda194c6a9d927819e43a09a to your computer and use it in GitHub Desktop.
managing sys.path with files is different folders within a project
# 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