On 07/02/2011 09:52 PM, Dan Stromberg wrote: > > Is there a decent way of running "from <variable> import *"? Perhaps > using __import__? > > Does it mean using the copy module or adding an element to globals() > somehow?
Yes, exactly. That's what `from x import *` does: Get the module, and then add all members to the global namespace. def import_all_from (module_name): mod = __import__(module_name) for member_name in dir(mod): globals()[member_name] = getattr(mod, member_name) Of course, don't do this, do what Gabriel said. -T -- http://mail.python.org/mailman/listinfo/python-list