From 4b2918d481df35cd7d6dec4c97349c59666eb760 Mon Sep 17 00:00:00 2001 From: SimonNordon4 Date: Mon, 5 Aug 2024 21:09:01 +1000 Subject: [PATCH] auto_load is loading but not initializing. --- entry.py | 7 +++---- template/__init__.py | 9 +++++---- template/auto_load.py | 3 +++ 3 files changed, 11 insertions(+), 8 deletions(-) diff --git a/entry.py b/entry.py index deafa4e..dbffc9f 100644 --- a/entry.py +++ b/entry.py @@ -6,9 +6,8 @@ sys.path.insert(0, script_dir) __package__ = os.path.basename(script_dir) -import hello_world.__init__ +import template.__init__ -if "auto_load" in locals(): - importlib.reload(hello_world.__init__) +importlib.reload(template.__init__) -hello_world.__init__.register() +template.__init__.register() diff --git a/template/__init__.py b/template/__init__.py index 87863ec..f98e254 100644 --- a/template/__init__.py +++ b/template/__init__.py @@ -1,14 +1,15 @@ -import auto_load +from . import auto_load -auto_load.init() +print("Loading template") def register(): - auto_load.register() + print("Registering template") + auto_load.test() + def unregister(): auto_load.unregister() -print("Hello from __init__.py") diff --git a/template/auto_load.py b/template/auto_load.py index 16da589..9f9daf7 100644 --- a/template/auto_load.py +++ b/template/auto_load.py @@ -12,6 +12,9 @@ modules = None ordered_classes = None +def test(): + print("Hello from auto_load.py") + def init(): global modules, ordered_classes modules = get_all_submodules(Path(__file__).parent)