We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 4f1b93c commit d80cde1Copy full SHA for d80cde1
pyomo/common/dependencies.py
@@ -676,6 +676,15 @@ def attempt_import(
676
assert defer_import is None
677
defer_import = defer_check
678
679
+ # If the module has already been imported, there is no reason to
680
+ # further defer things: just import it.
681
+ if defer_import is None:
682
+ if name in sys.modules:
683
+ defer_import = False
684
+ deferred_submodules = None
685
+ else:
686
+ defer_import = True
687
+
688
# If we are going to defer the check until later, return the
689
# deferred import module object
690
if defer_import:
0 commit comments