UnboundLocalError: local variable 'islenen_hesap_sayisi' referenced before assignment

12 Views Asked by At
class botucalistirclass(QtCore.QObject):


    redmessage = QtCore.pyqtSignal(str)
    greenmessage = QtCore.pyqtSignal(str)
    yellowmessage = QtCore.pyqtSignal(str)

    def bot(self):
        
        mode = "PC"
        if mode=="PC":
            while islenen_hesap_sayisi<hesapsayisi:
                islenen_hesap_sayisi += 1
                #Selenium codes

        elif mode=="VDS":
            #Selenium codes

            self.yellowmessage.emit("Program 24 saatlik bekleme süresine girdi.")

            time.sleep(86460)





class MainPage(QMainWindow):

        def __init__(self, *args, **kwargs):
            QtWidgets.QWidget.__init__(self, *args, **kwargs)
            loadUi("agb.ui", self)
            

            islenen_hesap_sayisi = 0

            hesap_sayisi = 10

hesap_sayisi is variable, just for example 10. When start other class, i getting error. Error is "UnboundLocalError: local variable 'islenen_hesap_sayisi' referenced before assignment". I want one variable use two class. How can do this?

0

There are 0 best solutions below