# api/__init__.py
"""Ensure project root is on sys.path before any submodule loads.

Python guarantees __init__.py runs before any submodule in the package is loaded.
This prevents ModuleNotFoundError for `from lib.xxx import ...` if a router is
imported before deps.py has had a chance to run its own sys.path insert.
"""
import sys
from pathlib import Path

PROJECT_ROOT = Path(__file__).resolve().parent.parent
if str(PROJECT_ROOT) not in sys.path:
    sys.path.insert(0, str(PROJECT_ROOT))
