""" Setup Python paths for external submodules. This module ensures that external submodules are added to sys.path before any other imports. It should be imported at the very beginning of __init__.py. """ import sys import os def setup_external_paths(): """Add external submodules to Python path if they exist.""" # Get the project root (parent of pyucc/) current_file = os.path.abspath(__file__) pyucc_dir = os.path.dirname(current_file) project_root = os.path.dirname(pyucc_dir) # Add external submodules external_base = os.path.join(project_root, "external") external_modules = [ os.path.join(external_base, "python-resource-monitor"), os.path.join(external_base, "python-tkinter-logger"), ] for module_path in external_modules: if os.path.isdir(module_path) and module_path not in sys.path: sys.path.insert(0, module_path) # Auto-execute when imported setup_external_paths()