Re: "dynamical" importing
Available news archives: comp.lang.tcl - comp.lang.python - comp.security.firewalls - sci.crypt - comp.lang.php - comp.lang.javascript
Google
 
Web news.hping.org


comp.lang.python archive

Re: "dynamical" importing

From: Laurent Rahuel <lrahuel.notgood@voila.fr>
Date: Wed Oct 19 2005 - 10:40:41 CEST

Hi,

I guess you need to look at __import__

Regards,

Laurent.

Joerg Schuster wrote:

> 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
Received on Mon Oct 24 01:47:15 2005