diff --git a/reflex/config.py b/reflex/config.py index 6ce3b873bab..2fcadb15227 100644 --- a/reflex/config.py +++ b/reflex/config.py @@ -988,8 +988,8 @@ def module(self) -> str: Returns: The module name. """ - if self.app_module is not None: - return self.app_module.__name__ + if self.app_module_import is not None: + return self.app_module_import return ".".join([self.app_name, self.app_name]) def update_from_env(self) -> dict[str, Any]: diff --git a/reflex/utils/exec.py b/reflex/utils/exec.py index 5caa1ad81fa..93aa232b4c2 100644 --- a/reflex/utils/exec.py +++ b/reflex/utils/exec.py @@ -300,9 +300,9 @@ def get_reload_paths() -> Sequence[Path]: The reload paths for the backend. """ config = get_config() - reload_paths = [Path(config.app_name).parent] - if config.app_module is not None and config.app_module.__file__: - module_path = Path(config.app_module.__file__).resolve().parent + reload_paths = [Path.cwd()] + if (spec := importlib.util.find_spec(config.module)) is not None and spec.origin: + module_path = Path(spec.origin).resolve().parent while module_path.parent.name and any( sibling_file.name == "__init__.py"