Files
SREBOT/BOT/__init__.py
T
NotSoToothless ff420e131f fix relative .data_parser imports in BOT/* after SHARED move (#1224)
PR #1223 + fixup moved data_parser into BOTS/SHARED, but five BOT modules
(analytics, autologging, botscript, lux_apis, meta_manager) still used
`from .data_parser import ...`. That relative form looks inside the BOT
package, which no longer contains data_parser, so the bot crashed at
startup with ModuleNotFoundError.

Add BOT/__init__.py to put BOTS/SHARED on sys.path at package import,
then switch all five files to absolute `from data_parser import ...`.

Co-authored-by: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
2026-05-13 23:30:15 -07:00

13 lines
392 B
Python

"""SREBOT bot package.
Bootstraps the sibling BOTS/SHARED directory onto sys.path so that
`from data_parser import ...` (and other SHARED-only modules) resolve
regardless of which submodule gets imported first.
"""
import sys
from pathlib import Path
_SHARED_DIR = Path(__file__).resolve().parents[2] / "SHARED"
if str(_SHARED_DIR) not in sys.path:
sys.path.insert(0, str(_SHARED_DIR))