Dynamically add Class to Modules

callmebill at gmail.com callmebill at gmail.com
Fri Dec 9 02:31:48 CET 2005

Oh!  I see what I missed.  I didn't supply the namespace into which the
new class was going to be added (correct that statement, please, if it
is incorrect).

So by using this slight modification, thinks seemed to work:
exec testModule.TheTestCode %(testModule.TheTestName,

testModule.TheTestName ) in testModule.__dict__

...and boom it appeared in the 2nd dir.

Did i do good?

More information about the Python-list mailing list