def btSearch(self): global macAddress try: self.resolver.open() #print "Bluetooth Search Start" GUI.drawLocationList() cont = lambda: self.resolver.discover(self.__callback, self.notifyMacAddress) while cont: cont() myLock.wait() if(self.myGUI.terminated == 1): #if this lock is resolved by the GUI break finally: self.resolver.close()