1

Possible Duplicate:
How does one do the equivalent of “import * from module” with Python's import function?

I'm trying to dynamically load a python module into the current module using a string for the name of the module. The command I'm trying to emulate is

from modulename import *

except using a string variable instead of "modulename". I'm having trouble understanding the python docs on import, but I see that if I do

_temp = __import__(modulename, globals(), locals(), [], -1)

this is functionally equivalent to

import modulename as _temp

which is close to what I want. But I want everything loaded into the current module's namespace. I'm hoping there's another way to call __import__ to accomplish this?

Community
  • 1
  • 1
Leopd
  • 41,333
  • 31
  • 129
  • 167
  • 4
    same as http://stackoverflow.com/questions/147507/how-does-one-do-the-equivalent-of-import-from-module-with-pythons-import – Simone Dec 15 '10 at 19:49

0 Answers0