__import__() with packages

Robert Brewer fumanchu at amor.org
Sun Apr 4 13:21:20 EDT 2004


Marco Herrn wrote:
> On 2004-04-04, John Roth <newsgroups at jhrothjr.com> wrote:
> > m = __import__("spam.eggs")
> > eggs = spam.eggs
> >
> > This will probably also work:
> >
> > eggs = __import__("spam.eggs").eggs
> 
> Thanks,
> but in my application I read the names of the modules from a file,
> so I do not know them when writing (in this case I wouldn't know the
> name 'eggs'). Since the solution from Paul works for me, I will use
> that.

Feel free to use my xray tool:

http://www.aminus.org/rbre/python/xray.py


Robert Brewer
MIS
Amor Ministries
fumanchu at amor.org




More information about the Python-list mailing list