newbie question - object from a string?

Gordon Scott gordon.scott at
Mon Nov 26 19:41:05 CET 2001

I'm writing a script to handle some event data and I came across a problem I
can't figure out.

The script loads a handler class and passes the data to function names I
have defined in a setup XML
file.  I want to abstract the handler class out and place that name in the
setup XML file as well
so that I can easily change handlers.

I can't seem to figure out how to get an object instance out of a string
that represents the class name.
eval() looks like it will work, but I get a name error because the class has
not been imported.

I've been plowing through the archives and seem to be driving myself in

Is there a way to dynamically import the class? Or is there entirely
different approach I should be 
using to accomplish this?

Any help would be appreciated...

More information about the Python-list mailing list