From c33cf459648521efaf76cbfa9b28abb022289824 Mon Sep 17 00:00:00 2001 From: "Owen W. Taylor" Date: Sun, 28 Oct 2007 08:46:23 -0400 Subject: [PATCH] Fix importing of nested modules --- lib/reinteract/notebook.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) diff --git a/lib/reinteract/notebook.py b/lib/reinteract/notebook.py index a7e8c7e..b34d2b2 100644 --- a/lib/reinteract/notebook.py +++ b/lib/reinteract/notebook.py @@ -55,15 +55,16 @@ class Notebook: f, pathname, description = imp.find_module(name) local = False else: - parent, local = self.__import_recurse(self, names[0:-1], fromlist) - f, pathname, description = imp.find_module(name, parent.__path__) + child_names = names[0:-1] + parent, local = self.__import_recurse(names[0:-1], fromlist) + f, pathname, description = imp.find_module(names[-1], parent.__path__) try: if local: module = imp.load_module(self.__prefix + "." + name, f, pathname, description) self.__modules[name] = module else: - module = imp.load_module(name, f, pathname, description) + module = imp.load_module(name, f, pathname, description) finally: if f != None: f.close() -- 2.11.4.GIT