I have two files that import the same object tracking method from a third file. It works something like this
file TrackingMethod
class Tracker(object):
def __init__(self,nodeName=None,dag=None,obj=None):
#Does some open maya stuff to get the dag path
def fullpath(self):
return dag.fullpath()
file Shapes #classes that create objects with shape nodes
import TrackingMethod as trm
reload(trm)
class circle(trm.Tracker):
def __init__(self,nodeName=None,dag=None,obj-None):
#does some shape related stuff then inits tracker
trm.Tracker.__init__(self,nodeName=nodeName,dag=dag,obj=obj)
file ShaderNodes #Classes that create shading nodes
import TrackingMethod as trm
reload(trm)
class shaderThingy(trm.Tracker):
def __init__(self,nodeName=None,dag=None,obj-None):
#does some shader related stuff then inits tracker
trm.Tracker.__init__(self,nodeName=nodeName,dag=dag,obj=obj)
Here's the problem. The error occurs at the trm.Tracker.init. If I use both files and I happen to reload() either ShaderNode or Shapes, the methods of the other will no longer recognize they're subclasses of the original TrackingMethod class. By reloading the other class loses it's reference back and I get either:
>>unbound method __init__() must be called with Tracker instance as first argument (got circle instance instead)
or
>>unbound method __init__() must be called with Tracker instance as first argument (got ShaderThingy instance instead)
..depending on which gets reloaded. Whichever is the last to get reloaded works, and the previously reloaded gets unbound.
Mind you, I need to reload these scripts to test my changes. I know once the reloads are out of there they'll no longer be unbound, but I need to see my changes as I work.
What do I do?