Using the imp module

Claus Tondering claus.tondering at gmail.com
Tue Oct 10 16:24:23 CEST 2006


I wrote:
> Fredrik Lundh wrote:
> >     globals().update(vars(__import__("xyzzy")))
>
> Thank you, I can use that in some cases. However, I need to import a
> file that is not in the load path. The imp module allows me to specify
> a path name; but as far as I know, the __import__ function does not
> allow me to do that.

Oops, I forgot to add that I realize that the update(vars(...)) feature
works well with the imp module too.
 
--
Claus Tondering




More information about the Python-list mailing list