Skip to content

Commit 42c2467

Browse files
committed
Lazily import modules like numpy/pandas/keras
1 parent 53eebda commit 42c2467

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/inspectorscripts.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,9 @@ __xr = None
4343
4444
def _attempt_import(module):
4545
try:
46-
return __import__(module)
46+
# Only "import" if it was already imported
47+
if module in sys.modules:
48+
return __import__(module)
4749
except ImportError:
4850
return None
4951

0 commit comments

Comments
 (0)