Arnaud Delobelle wrote: > > If your class lives in the current global namespace, you can get it > with > > >>> cls = globals()[classname] > > Then you can access its .bar() method directly: > > >>> cls.bar() > > Example: > > >>> class Foo(object): > ... @classmethod > ... def bar(cls): print 'Oh my Baz!' > ... > >>> globals()['Foo'] > <class ' main .Foo'> > >>> globals()['Foo'].bar() > Oh my Baz! > > If your class lives in a module, just do getattr(module, classname) > instead to get the class object. > > HTH > >
Yes, that feels much nicer and works well. Thanks for the prompt reply ! -- http://mail.python.org/mailman/listinfo/python-list