Importing module with name given as a variable
Sean Davis
seandavi at gmail.com
Sat Aug 30 14:02:03 EDT 2008
What is the "best practice" for importing an arbitrary module given
that the name is stored in a variable? The context is a simple web
application with URL dispatching to a module and function. I know of
__import__(), the imp module, and exec. For each of these, is there a
way to make them work "just like" the normal import call?
Thanks,
Sean
More information about the Python-list
mailing list