import time from threading import Thread # You must initialize the gobject/dbus support for threading # before doing anything. import gobject gobject.threads_init() from dbus import glib glib.init_threads() # Create a session bus. import dbus bus = dbus.SessionBus() # Create an object that will proxy for a particular remote object. remote_object = bus.get_object("org.freedesktop.DBus", # Connection name "/org/freedesktop/DBus" # Object's path ) # Get a particular interface iface = dbus.Interface(remote_object, 'org.freedesktop.DBus') def ifaceHandler(iface,i): print "thread %d" % i print iface.GetId() for i in range(1000): t = Thread(target=ifaceHandler, args=(iface,i)) t.start()