how to import from variable source

Rob Brown-Bayliss rob at ZOOstation.cc
Sat Apr 14 15:35:23 EDT 2001


Hello

I am building a shell type app that imports modules depending on the
users actions.

I do not want to have the import routines hard coded, rather I would
like to import from a variable like so:

module = 'mymod'
import module

Only, as I found out I get an error stating that there is not module
called module.

Is this possible in python?  Is there a better way perhapse?

Thanks,
 

-- 

  Rob Brown-Bayliss
 ---======o======---
  www.ZOOstation.cc




More information about the Python-list mailing list