[Tutor] Dynamically composing a module name

Bernard Lebel 3dbernard at gmail.com
Tue Apr 19 22:36:08 CEST 2005


Hi,

The one thing I would try, if I understand what you're after
correctly, would be to run a exec command with the module name.


modulename = 'myModule'
exec 'import ' + modulename

Then you can access the module names as any imported module.


Cheers
Bernard


On 4/19/05, Tim Johnson <tim at johnsons-web.com> wrote:
> Hello Pythonmeisters:
> 
> Is it possible to dynamically compose a module name
> for import?
> 
> Pointers to documentation or other discussions would
> be sufficient at this time.
> 
> thanks
> --
> Tim Johnson <tim at johnsons-web.com>
>       http://www.alaska-internet-solutions.com
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>


More information about the Tutor mailing list