fix: register CLI module in sys.modules for proper package resolution
Some checks failed
CLI Tests / test-cli (push) Has been cancelled
Cross-Node Transaction Testing / transaction-test (push) Has been cancelled
Deploy to Testnet / deploy-testnet (push) Has been cancelled
Multi-Node Stress Testing / stress-test (push) Has been cancelled
Security Scanning / security-scan (push) Has been cancelled

- Added sys.modules["aitbc_cli.core.main"] registration before exec_module
- Fixes ModuleNotFoundError for aitbc_cli.utils.dual_mode_wallet_adapter
- Ensures subpackage imports resolve correctly when loaded via spec_from_file_location
- Allows wallet commands to import from aitbc_cli.utils properly
This commit is contained in:
aitbc
2026-05-26 11:26:18 +02:00
parent c96309e76f
commit 7fdc3e2619

View File

@@ -35,6 +35,8 @@ def _load_cli_module() -> ModuleType:
raise ImportError(f"Unable to load modular CLI entrypoint from {cli_path}")
module = importlib.util.module_from_spec(spec)
# Register module in sys.modules with proper package name for import resolution
sys.modules["aitbc_cli.core.main"] = module
spec.loader.exec_module(module)
_CLI_MODULE = module
return module