[EMAIL PROTECTED] wrote:
> I'm trying to import a module at runtime using variables to specify
> which module, and which functions to execute. for example:
>
> mStr = "sys"
> fStr = "exit"
>
> # load mod
> mod = __import__(mStr)
> # call function
> mod.fStr()
getattr(mod, fStr)()
--
Giovanni Ba
Hi,
if you want to import module dynamically, you can use __import__ ..
always remember modules are objects ..
mStr="sys"
mod=__import__(mStr)
# Now u can use mod.version .. but cant specify the attribute using
other variable, like u did
mod.version
should read it
http://diveintopython.org/funct