#!/usr/bin/env python
# Pass an object through a queue to another process.
from processing import Process, Queue, currentProcess
class Example:
def __init__(self, name):
self.name = name
def __str__(self):
return '%s (%s)' % (self.name, currentProcess())
def f(q):
print 'In child:', q.get()
if __name__ == '__main__':
q = Queue()
p = Process(target=f, args=[q])
p.start()
o = Example('tester')
print 'In parent:', o
q.put(o)
p.join()