getting modules optionally
Giorgi Lekishvili
gleki at gol.ge
Wed Nov 21 17:10:15 EST 2001
Dear all!
I apologize for this nebye-like question.
Suppose, we have a package with one __init__.py file, while the rest are
other modules (let's call them active modules), which do the essential
stuff.
Apparently, I need to start like this:
from MyPackage import *
I need to import only one active module. This can be done by hardcoding:
from MyPackage.ThisModule import *
What I can not do is to import the module, if I have its name as string.
modname='ThisModule'
Of course, the code below doesn't work:
from MyPackage.modname import *
The question: is there something like eval function, which could
transfer the string as the real module name? In other words, how have I
to treat the modname to make this code running?
from MyPackage.modname import *
Thank you very much for your time.
Best regards,
Giorgi Lekishvili
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20011121/42c6a652/attachment.html>
More information about the Python-list
mailing list