"dynamical" importing

Joerg Schuster joerg.schuster at gmail.com
Wed Oct 19 04:36:57 EDT 2005


Hello,

I need to import modules from user defined paths. I.e. I want to do
something
like:

module_dir = sys.argv[1]

my_path = os.path.join(module_dir, 'bin', 'my_module')

from my_path import my_object

Obviously, it doesn't work this way. How would it work?

Jörg Schuster




More information about the Python-list mailing list