Add exception handling for module discovery
This commit is contained in:
parent
440d72896f
commit
1fbca4a652
7
main.py
7
main.py
@ -5,8 +5,11 @@ import os
|
||||
print("Loading modules")
|
||||
modules = {}
|
||||
for folder in os.listdir("./modules"):
|
||||
curr_module = importlib.import_module('.' + folder, package="modules")
|
||||
modules[folder] = curr_module.get_module()
|
||||
try:
|
||||
curr_module = importlib.import_module('.' + folder, package="modules")
|
||||
modules[folder] = curr_module.get_module()
|
||||
except AttributeError:
|
||||
pass
|
||||
print("Modules loaded successfully.\n")
|
||||
|
||||
print("Available Modules:")
|
||||
|
Loading…
Reference in New Issue
Block a user