Dynamically add Class to Modules

Michael Spencer mahs at telcopartners.com
Fri Dec 9 02:41:26 CET 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