From a821060084a53fe6d570a6ac26bfe831daa081d3 Mon Sep 17 00:00:00 2001 From: Chuck Date: Thu, 19 Feb 2026 09:29:19 -0500 Subject: [PATCH] fix(starlark): reload tronbyte_repository module to pick up code changes The web service caches imported modules in sys.modules. When deploying code updates, the old cached version was still being used. Now uses importlib.reload() when module is already loaded. Co-Authored-By: Claude Sonnet 4.5 --- web_interface/blueprints/api_v3.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/web_interface/blueprints/api_v3.py b/web_interface/blueprints/api_v3.py index 90f381a8..9860158a 100644 --- a/web_interface/blueprints/api_v3.py +++ b/web_interface/blueprints/api_v3.py @@ -6982,11 +6982,17 @@ def clear_old_errors(): def _get_tronbyte_repository_class(): """Import TronbyteRepository from plugin-repos directory.""" import importlib.util + import importlib module_path = PROJECT_ROOT / 'plugin-repos' / 'starlark-apps' / 'tronbyte_repository.py' if not module_path.exists(): raise ImportError(f"TronbyteRepository module not found at {module_path}") + # If already imported, reload to pick up code changes + if "tronbyte_repository" in sys.modules: + importlib.reload(sys.modules["tronbyte_repository"]) + return sys.modules["tronbyte_repository"].TronbyteRepository + spec = importlib.util.spec_from_file_location("tronbyte_repository", module_path) module = importlib.util.module_from_spec(spec) sys.modules["tronbyte_repository"] = module