pedals = [] for i in range(0, 5): pedal = "/Root/Pedal_" + str(i) + "/" pedals.append(Pedal(i, int(xml.get(pedal + "GPIO")), int(xml.get(pedal + "Actions/Simple_Press")), int(xml.get(pedal + "Actions/Double_Press")), int(xml.get(pedal + "Actions/Long_Press")), shift, sooper)) pedals[i].start() current_ip = str(xml.get_ip_client()) current_port = int(xml.get_port_client()) sooper.set_connection(current_ip, current_port) thread = Save(xml) thread.start() def save_data(): xml.write() print 'saved' while True: try: d = s.recvfrom(1024) data = d[0].split() addr = d[1]