1def foo(bar, baz):
2 print 'hello {0}'.format(bar)
3 return 'foo' + baz
4
5from multiprocessing.pool import ThreadPool
6pool = ThreadPool(processes=1)
7
8async_result = pool.apply_async(foo, ('world', 'foo')) # tuple of args for foo
9
10# do some other stuff in the main process
11
12return_val = async_result.get() # get the return value from your function.