Francisco Borges wrote: > There are 2 "foo" named modules, 'std foo' and 'my foo'. I want to be > able to import 'my foo' and then from within my foo, import 'std > foo'. Anyone can help??
In other words, you would like to make a "patch" on third-party code. There are many ways to do it. Here is just one possible approach. #--------- A.py: third-party module x = 3 def f(): return 'A.f(): x=%d' % x #--------- B.py: your modifications to the module def f(): return 'B.f(): x=%d' % x #--------- Main.py: your program import imp # load the third party module into sys.modules imp.load_source('A', '', open('C:\\A.py')) # load and execute your changes imp.load_source('A', '', open('C:\\B.py')) # import now from memory (sys.modules) import A print A.f() -- http://mail.python.org/mailman/listinfo/python-list