Import a file to namespace

Jeffrey Froman jeffrey at fro.man
Thu Mar 20 13:24:52 EDT 2008


Pedro Machado Santa wrote:

> import testpackage
> 
> class testClass():
> #...
> 
> testpackage.testClass =  testClass


This method should work fine. Modules are effectively singletons, so running
this code one time anywhere in your application will cause the changes to
appear in all references to the original module.


Jeffrey



More information about the Python-list mailing list