import sys from pathlib import Path def _ensure_src_on_syspath(): root = Path(__file__).resolve().parents[1] src = root / "src" src_str = str(src) # Insert at position 0 to ensure it takes precedence if src_str not in sys.path: sys.path.insert(0, src_str) _ensure_src_on_syspath()