Skip to content

🐍 Geometric Computer Vision Library for Spatial AI

fix: import the module within LazyLoader when an accessed dependency is installed (#3046)

Sam Armstrong23b7ccb99788
diff --git a/kornia/core/external.py b/kornia/core/external.py
index a600eb352..8161d0546 100644
--- a/kornia/core/external.py
+++ b/kornia/core/external.py
@@ -74,10 +74,12 @@ class LazyLoader:
while to_ask:
if if_install.lower() == "y" or if_install.lower() == "yes":
self._install_package(self.module_name)
+ self.module = importlib.import_module(self.module_name)
to_ask = False
elif if_install.lower() == "a" or if_install.lower() == "all":
self.auto_install = True
self._install_package(self.module_name)
+ self.module = importlib.import_module(self.module_name)
to_ask = False
elif if_install.lower() == "n" or if_install.lower() == "no":
raise ImportError(