From a01dbbab49c1a36eed9a22699942c851ab1eabcf Mon Sep 17 00:00:00 2001 From: Jack Kuan Date: Fri, 5 Dec 2014 16:18:52 -0500 Subject: [PATCH] Make web2py's custom_import work with circular imports. --- gluon/custom_import.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gluon/custom_import.py b/gluon/custom_import.py index 2f627609..5f68163e 100644 --- a/gluon/custom_import.py +++ b/gluon/custom_import.py @@ -81,7 +81,7 @@ def custom_importer(name, globals=None, locals=None, fromlist=None, level=-1): new_mod = base_importer( modules_prefix, globals, locals, [itemname], level) try: - result = result or new_mod.__dict__[itemname] + result = result or sys.modules[modules_prefix+'.'+itemname] except KeyError, e: raise ImportError, 'Cannot import module %s' % str(e) modules_prefix += "." + itemname