Files
dima/notebooks/nbutils.py

16 lines
597 B
Python

import sys
import os
def add_project_path_to_sys_path():
"""
Adds the project path (root directory containing the package) to sys.path.
"""
# Determine the root directory (project_root, which contains 'dima')
notebook_dir = os.getcwd() # Current working directory (assumes running from notebooks/)
project_path = os.path.normpath(os.path.join(notebook_dir, "..")) # Move up to project root
if project_path not in sys.path: # Avoid duplicate entries
sys.path.append(project_path)
if __name__ == "__main__":
add_project_path_to_sys_path()