summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Lib/imputil.py3
1 files changed, 2 insertions, 1 deletions
diff --git a/Lib/imputil.py b/Lib/imputil.py
index 3185d7d..2f87d69 100644
--- a/Lib/imputil.py
+++ b/Lib/imputil.py
@@ -282,7 +282,8 @@ class Importer:
if not is_module:
exec code in module.__dict__
- return module
+ # fetch from sys.modules instead of returning module directly.
+ return sys.modules[fqname]
def _load_tail(self, m, parts):
"""Import the rest of the modules, down from the top-level module.