Newbie question.. how to load modules with a dynamic name?
dsavitsk
dsavitsk at e-coli.net
Fri Feb 23 16:20:25 EST 2001
"Ron Scinta" <nb0klun71q5001 at sneakemail.com> wrote in message
news:D7zl6.221$Gm2.5547 at skycache.prestige.net...
> I have a need to run various python script files from a master control
> script, however, I do not know the names of the scripts until runtime.
>
> I will be getting the script names from a database.. and was thinking I
> could just use the import call with the supplied name.
>
> This does not work alas....
> >>> mymod = "ptw"
>>> exec('import ' + mymod)
ds
More information about the Python-list
mailing list