From ce84b5efd3dbca18c3de0e1be33d76d78c06764e Mon Sep 17 00:00:00 2001 From: Lily Wang Date: Thu, 7 Nov 2024 15:29:20 +1100 Subject: [PATCH] fall back to getattr --- openff/toolkit/__init__.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/openff/toolkit/__init__.py b/openff/toolkit/__init__.py index 8624d5d41..5fcd9bc70 100644 --- a/openff/toolkit/__init__.py +++ b/openff/toolkit/__init__.py @@ -79,7 +79,10 @@ def __getattr__(name): obj_mod = _lazy_imports_obj.get(name) if obj_mod is not None: mod = importlib.import_module(obj_mod) - return mod.__dict__[name] + try: + return mod.__dict__[name] + except KeyError: # account for lazy loaders + return getattr(mod, name) lazy_mod = _lazy_imports_mod.get(name) if lazy_mod is not None: