Weird 'object has no attribute' error
<p>I'm working on some python coding using classes, and I'm getting some weird errors.</p>

<p>I have 4 files running, each with their class and methods. They run fine, but after some time I get the error e.g <code>CLASS_1</code> object has no attribute <code>validate</code> (it is not always the same file that crashes, and sometime more files are crashing at the same time).</p>

<pre><code>class CLASS_1(object):
    def __init__(self,SOURCE_OBJS,TARGET_OBJ):
        self.s_objList = SOURCE_OBJS
        self.t_obj = TARGET_OBJ
        self.flag = None

    def validate(self):
        for obj in self.s_objList:
            if GetElementStateBySysId(obj,2**15) == 2**15:
                if self.flag != True:
                    SetCtcEventBySysId(self.t_obj,5009)
                    SetCtcEventBySysId(self.t_obj,5011)
                    self.flag = True
                break
        else:
            if self.flag != False:
                SetCtcEventBySysId(self.t_obj,5008)
                self.flag = False


class1_list = []
class1_list.append(CLASS_1([72922,72923,72924,72925,72970,72971,72972,72973],70101))
class1_list.append(CLASS_1([72926,72927,72928,72929],70102))
class1_list.append(CLASS_1([72930,72931,72932,72933],70103))
class1_list.append(CLASS_1([72944,72945,72946,72947,72948,72949,72974,72975,72976,72977,72978,72979],70104))
class1_list.append(CLASS_1([72950,72951,72952,72953],70105))

while True:
    for obj in class1_list :
        obj.validate()
    wait(1)
</code></pre>

<p>The other files are having the same functionality, but the name of the classes are <code>CLASS_2</code>, <code>CLASS_3</code> and <code>CLASS_4</code> - further more they are appended to their own arrays (<code>class2_list</code>, <code>class3_list</code> and <code>class4_list</code>).</p>
