Dynamically add Class to Modules

Michael Spencer mahs at telcopartners.com
Thu Dec 8 20:41:26 EST 2005


callmebill at gmail.com wrote:
...
> exec testModule.TheTestCode %(testModule.TheTestName, testModule.TheTestName )

...

Try changing that to exec ~ in testModule.__dict__

otherwise, your class statement gets executed in the current scope

Michael




More information about the Python-list mailing list