1
0

Fixed backend module importing
All checks were successful
Test Python / Test (push) Successful in 26s

This commit is contained in:
Jon Michael Aanes 2024-08-09 16:20:13 +02:00
parent 8c6ff75a71
commit dcecd9f362
Signed by: Jmaa
SSH Key Fingerprint: SHA256:Ab0GfHGCblESJx7JRE4fj4bFy/KRpeLhi41y4pF3sNA

View File

@ -74,13 +74,14 @@ CURRENT_MODULE = sys.modules[__name__]
def load_backend(name: str) -> object | None:
try:
imported_module = importlib.import_module(f'{__name__}.{name}')
CURRENT_MODULE.setmember(name, imported_module)
except Exception:
logger.exception(
'Backend "%s" could not be imported. Are all module dependencies installed?',
name,
)
return None
setattr(CURRENT_MODULE, name, imported_module)
return imported_module
# Import modules