__import__() with packages

Marco Herrn herrn at gmx.net
Sun Apr 4 12:37:19 EDT 2004


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 
-- 
Marco Herrn             herrn at gmx.net
(GnuPG/PGP-signed and crypted mail preferred)
Key ID: 0x94620736




More information about the Python-list mailing list