Python DBus Multithread


I am very new to python programming and I’m trying to make a script that listen to pidgin incoming message and process it but I don’t want to get locked if another message is coming in.
I couldn’t seem to get it work.

I try to google it and many answer said you have to use gobject.threads_init() but it doesn’t seem to work. Could anyone help me what I’ve done wrong.

My Code:

def pidginRecv(account, sender, message, conversation, flags):
  print 'abc'

pidginBus = dbus.SessionBus()
pidginBus.add_signal_receiver(pidginRecv, dbus_interface='im.pidgin.purple.PurpleInterface', signal_name='ReceivedImMsg')
pidginObj = pidginBus.get_object('im.pidgin.purple.PurpleService', '/im/pidgin/purple/PurpleObject')
pidginFunc = dbus.Interface(pidginObj, 'im.pidgin.purple.PurpleInterface')
pidginLoop = gobject.MainLoop()

What I’m trying to do is when pidgin received message, it will print ‘abc’ and then do some function (in this try code I use sleep) but if another message is coming in, it will print another ‘abc’ even though the first process not yet finished.

The above code seem to lock for 10 sec and then print another ‘abc’ and lock again for 10 sec.

Thank you for the help.