From: fredrik at pythonware.com (Fredrik Lundh)
Date: Mon, 19 Apr 1999 08:14:46 GMT
Subject: Plugins, or selecting modules to import at runtime
References: <924379180.825429211@news.intergate.bc.ca>
Message-ID: <017201be8a3e$d327a9f0$f29b12c2@pythonware.com>
X-UID: 929                                                  

Gerald Gutierrez <gutier at intergate.bc.ca> wrote:
> I'd like to write a program in Python in which the user can select one of
> several modules to execute through a function that has the same name in all the
> modules. I don't believe "import" lets me pass it a string. There is also
> reload(), but the module to reload must be previously imported.
> 
> This is very similar to plugins like that used in Netscape, Photoshop and the
> GIMP.
> 
> Can someone please give me a hint?

module = __import__("module")

also see:
http://www.pythonware.com/people/fredrik/fyi/fyi06.htm

</F>





