From 07c2f2f81de56b9ac95e8b6145b6b94c7679535e Mon Sep 17 00:00:00 2001 From: dmamelin Date: Tue, 9 Dec 2025 15:55:27 +0100 Subject: [PATCH] fix module context starting before Home Assistant; see #784 --- custom_components/pyscript/__init__.py | 2 +- custom_components/pyscript/global_ctx.py | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/custom_components/pyscript/__init__.py b/custom_components/pyscript/__init__.py index 60c0bc0..79e5fc5 100644 --- a/custom_components/pyscript/__init__.py +++ b/custom_components/pyscript/__init__.py @@ -133,7 +133,7 @@ def start_global_contexts(global_ctx_only: str = None) -> None: start_list = [] for global_ctx_name, global_ctx in GlobalContextMgr.items(): idx = global_ctx_name.find(".") - if idx < 0 or global_ctx_name[0:idx] not in {"file", "apps", "scripts"}: + if idx < 0 or global_ctx_name[0:idx] not in {"file", "apps", "modules", "scripts"}: continue if global_ctx_only is not None and global_ctx_only != "*": if global_ctx_name != global_ctx_only and not global_ctx_name.startswith(global_ctx_only + "."): diff --git a/custom_components/pyscript/global_ctx.py b/custom_components/pyscript/global_ctx.py index 9041b3e..3d382ed 100644 --- a/custom_components/pyscript/global_ctx.py +++ b/custom_components/pyscript/global_ctx.py @@ -188,7 +188,7 @@ def find_first_file(file_paths: List[Set[str]]) -> List[Optional[Union[str, Modu global_ctx = GlobalContext( ctx_name, global_sym_table=mod.__dict__, manager=self.manager, rel_import_path=rel_import_path ) - global_ctx.set_auto_start(True) + global_ctx.set_auto_start(self.auto_start) _, error_ctx = await self.manager.load_file(global_ctx, file_path) if error_ctx: _LOGGER.error(