Skip to content

Commit 95e8f77

Browse files
committed
do not prematurely import app module if providing app_module_import
1 parent c849cd8 commit 95e8f77

2 files changed

Lines changed: 8 additions & 4 deletions

File tree

reflex/config.py

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -988,8 +988,8 @@ def module(self) -> str:
988988
Returns:
989989
The module name.
990990
"""
991-
if self.app_module is not None:
992-
return self.app_module.__name__
991+
if self.app_module_import is not None:
992+
return self.app_module_import
993993
return ".".join([self.app_name, self.app_name])
994994

995995
def update_from_env(self) -> dict[str, Any]:

reflex/utils/exec.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -301,8 +301,12 @@ def get_reload_paths() -> Sequence[Path]:
301301
"""
302302
config = get_config()
303303
reload_paths = [Path(config.app_name).parent]
304-
if config.app_module is not None and config.app_module.__file__:
305-
module_path = Path(config.app_module.__file__).resolve().parent
304+
if (
305+
config.app_module_import is not None
306+
and (spec := importlib.util.find_spec(config.app_module_import)) is not None
307+
and spec.origin
308+
):
309+
module_path = Path(spec.origin).resolve().parent
306310

307311
while module_path.parent.name and any(
308312
sibling_file.name == "__init__.py"

0 commit comments

Comments
 (0)