Loading a class the name of which is only known runtime

Mads Orbesen Troest mads at troest.NEVERMORE.dk
Tue Apr 8 15:05:03 EDT 2003


On Wed, 09 Apr 2003 03:35:19 +1000, Simon Burton wrote:

Hi Simon, tbanks for your response.

>>>> instance = locals()[name]()

Interesting suggestion (I learned something new here :), but the problem is 
that the class(es) must be external, residing in separate .py files 
(possible in a package) outside the executing script, so the solution 
proposed here won't do.

Regards,
   /\/\\ads Orbesen Troest




More information about the Python-list mailing list