A simple example on using threads in Python:
import threading
import time
class Shuttle(threading.Thread):
def __init__(self, callsign):
threading.Thread.__init__(self)
self.callsign = callsign
def run(self):
for i in range(20):
print self.callsign, i, "\n"
time.sleep(3)
def runit(shuttles):
for shuttle in shuttles:
shuttle.start()
time.sleep(0.1)
one = Shuttle("Galaxy")
two = Shuttle("Lightning")
runit([one, two])