python - importing and reloading a class in another module -


i used this:

from othermodule import oldclass  class newclass(oldclass):     def __init__(self,name):         oldclass.__init__(name) 

which worked no issues. however, want make 2 changes (the following code doesn't work, represents want do):

import othermodule om; reload(om)  class newclass(om.oldclass):     def __init__(self,name):         om.oldclass.__init__(name) 

two things:

  1. i want othermodule reload don't have manually reload on common line time.
  2. the above code doesn't die on inheritance of om.oldclass, om.oldclass.__init__ fails recursive call __init__ of base class.

any appreciated. thanks.

edit:

the reason want reload because work in environment hundreds of files can change , won't reloaded automatically when modules write reloaded. don't want have command line: reload(mymod); reload(mymod.a); reload(mymod.b); etc. handling in mymod makes more efficient develop code in environment. i'm not interested in defending reload statement, please @ other issues - how import , reload class module , how call init.

here picture of issue:

enter image description here


Comments