title: How do i get values from 1 def to an other inside the same class?
body: <p>I am making an object detection app from my last year in highschool I am having some troubles.
  I am looking for a way to use the string username from the def verify in another def like Change.
  I already tried to make it a global and sending the username from my kV file strait to the change def but none of them worked.
  Here is my code.</p>
  <pre><code>class GipApp(MDApp):
      def build(self):
          self.theme_cls.primary_palette = 'Blue'
          screen = Builder.load_string(screen_helper)
  
          return screen
  
      def verify(self, username, password):
          if username != &quot;&quot; and password != &quot;&quot;:
              for row in MySqlNames:
                  if row[0].strip() == username:
                      sql = &quot;SELECT Password from ID191774_6itn1project7.Users where Username = %s &quot;
                      mycursor.execute(sql, (username))
                      TestPassword = mycursor.fetchall()
                      for row3 in TestPassword:
                          if row3[0].strip() == password:
                              print(&quot;inloggen is gelukt&quot;)
                              sm.current_screen = 'Main'
                              return
                          if row3[0] != password:
                              dialog = MDDialog(title=&quot;Passwords is not correct.&quot;)
                              dialog.open()
  
          else:
              dialog = MDDialog(title=&quot;Fill in the empty text boxes&quot;)
              dialog.open()
  
  
      def register(self, RegUsername, RegPassword, RegRepeatPassword):
          if RegPassword != &quot;&quot; and RegRepeatPassword != &quot;&quot; and RegUsername != &quot;&quot;:
              if RegPassword == RegRepeatPassword:
                  current_datetime = datetime.now()
                  insert = &quot;INSERT INTO Users(Username, Password, DateOfRegistration) VALUES (%s,%s,%s)&quot;
                  mycursor.execute(insert, (RegUsername, RegPassword, current_datetime))
                  conn.commit()
                  dialog = MDDialog(title=&quot;You are successfully registered&quot;)
                  dialog.open()
              if RegRepeatPassword != RegPassword:
                  dialog = MDDialog(title=&quot;Passwords are not the same. Please try again.&quot;)
                  dialog.open()
                  print(MySqlNames)
          else:
              dialog = MDDialog(title=&quot;Fill in the empty text boxes&quot;)
              dialog.open()
  
      def Yolo(self):
          cap = cv.VideoCapture(0)
          whT = 320
          confThreshold = 0.4
          nmsThreshold = 0.2
  
          classesFile = &quot;coco.names&quot;
          classNames = []
          with open(classesFile, 'rt') as f:
              classNames = f.read().rstrip('\n').split('\n')
          print(classNames)
  
          modelConfiguration = &quot;yolov3.cfg&quot;
          modelWeights = &quot;yolov3.weights&quot;
          net = cv.dnn.readNetFromDarknet(modelConfiguration, modelWeights)
          net.setPreferableBackend(cv.dnn.DNN_BACKEND_OPENCV)
          net.setPreferableTarget(cv.dnn.DNN_TARGET_CPU)
  
          def findObjects(outputs, img):
              hT, wT, cT = img.shape
              bbox = []
              classIds = []
              confs = []
              for output in outputs:
                  for det in output:
                      scores = det[5:]
                      classId = np.argmax(scores)
                      confidence = scores[classId]
                      if confidence &gt; confThreshold:
                          w, h = int(det[2] * wT), int(det[3] * hT)
                          x, y = int((det[0] * wT) - w / 2), int((det[1] * hT) - h / 2)
                          bbox.append([x, y, w, h])
                          classIds.append(classId)
                          confs.append(float(confidence))
  
              indices = cv.dnn.NMSBoxes(bbox, confs, confThreshold, nmsThreshold)
  
              for i in indices:
                  i = i[0]
                  box = bbox[i]
                  x, y, w, h = box[0], box[1], box[2], box[3]
                  # print(x,y,w,h)
                  cv.rectangle(img, (x, y), (x + w, y + h), (255, 0, 0), 2)
                  cv.putText(img, f'{classNames[classIds[i]].upper()} {int(confs[i] * 100)}%',
                             (x, y - 10), cv.FONT_HERSHEY_SIMPLEX, 0.6, (255, 0, 0), 2)
  
                  DetectedName = (f'{classNames[classIds[i]].upper()}')
                  DetectedProcent = (f'{int(confs[i] * 100)}%')
                  print(DetectedName)
                  print(DetectedProcent)
                  current_datetime = datetime.now()
                  print(current_datetime)
                  insert = &quot;INSERT INTO DetectedObjects (WayOfDetection, ObjectName, Certainty, TimeOfDetection) VALUES (%s,%s,%s,%s)&quot;
                  mycursor.execute(insert, (&quot;webcam&quot;, DetectedName, DetectedProcent, current_datetime))
                  conn.commit()
  
  
          while True:
              success, img = cap.read()
  
              blob = cv.dnn.blobFromImage(img, 1 / 255, (whT, whT), [0, 0, 0], 1, crop=False)
              net.setInput(blob)
              layersNames = net.getLayerNames()
              outputNames = [(layersNames[i[0] - 1]) for i in net.getUnconnectedOutLayers()]
              outputs = net.forward(outputNames)
              findObjects(outputs, img)
  
              cv.imshow('Image', img)
              key = cv.waitKey(1)
              if key == 27:
                  break
  
      def Change(self, Password, PasswordReg, username):
          if Password != &quot;&quot; and PasswordReg != &quot;&quot;:
              if Password == PasswordReg:
                  insert = &quot;UPDATE `Users` SET `Password`= %s where Username = %s &quot;
                  mycursor.execute(insert, (PasswordReg, username))
                  conn.commit()
                  dialog = MDDialog(title=&quot;The password has been changed.&quot;)
                  dialog.open()
              if Password != PasswordReg:
                  dialog = MDDialog(title=&quot;New passwords are not the same. Please try again.&quot;)
                  dialog.open()
                  print(MySqlNames)
          else:
              dialog = MDDialog(title=&quot;Fill in the empty text boxes&quot;)
              dialog.open()
  </code></pre>
  <p>I hope somebody can help me.</p>