From a747a680478653ab73c3f9323aeb5fee45147b60 Mon Sep 17 00:00:00 2001 From: Iisakki Rotko Date: Fri, 15 Sep 2023 16:40:33 +0200 Subject: [PATCH] fix: reload all modules in the package when run as subpackage (#293) * fix: subpackage changes not autoreloaded * fix: MyPy error when mod.__file__ is None --- solara/server/app.py | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/solara/server/app.py b/solara/server/app.py index d0a43c7d9..43c1fdfc1 100644 --- a/solara/server/app.py +++ b/solara/server/app.py @@ -79,6 +79,12 @@ def __init__(self, name, default_app_name="Page"): self._first_execute_app = app reload.reloader.root_path = self.directory + if self.type == AppType.MODULE: + package_name = self.name.split(".")[0] + mod = importlib.import_module(package_name) + if mod.__file__ is not None: + package_root_path = Path(mod.__file__).parent + reload.reloader.root_path = package_root_path app_context.close() def _execute(self):