Anyone know how to do this?:

I want a way to dynamically import modules (module names not known until runtime).  I want to end up with a handle to the resulting module object, without having poluted my global module namespace in the process.

Basically I want to something like this:

def  call_all_user_supplied_foo_functions(user_script_pathanmes):
   for f in user_script_pathanmes:
      a_module = magic_module_import_function(f)
      a_module.foo()

Any ideas?

I've looked at using imp.load_source() or imp.load_module(), but it looks to me like all of these polute the global namespace with the names of the modules I'm importing.

Thanks,
Christian
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to