Skip to content

Commit

Permalink
auto_load is loading but not initializing.
Browse files Browse the repository at this point in the history
  • Loading branch information
SimonNordon4 committed Aug 5, 2024
1 parent 58f6dd8 commit 4b2918d
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 8 deletions.
7 changes: 3 additions & 4 deletions entry.py
Original file line number Diff line number Diff line change
Expand Up @@ -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()
9 changes: 5 additions & 4 deletions template/__init__.py
Original file line number Diff line number Diff line change
@@ -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")



3 changes: 3 additions & 0 deletions template/auto_load.py
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 4b2918d

Please sign in to comment.