importing two modules with the same name

Francisco Borges francisco.borges at gmail.com
Sun Mar 20 08:01:07 EST 2005


El Pitonero wrote:
>  #--------- 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

Thanks a bunch for the hint. The imp module did take care of the job,
but just to mention load_source seems to be deprecated, so I used

fp, mpath, desc = imp.find_module('optparse',a)
s_opt = imp.load_module('std_optparse', fp, mpath, desc)

again, thanks for the help! 

Cheers,
Francisco




More information about the Python-list mailing list