from concurrent.futures import ProcessPoolExecutor import multiprocessing import asyncio @asyncio.coroutine def _do_coro_proc_work(): print("in coroutine") def do_coro_proc_work(): loop = asyncio.get_event_loop() print(loop) loop.run_until_complete(_do_coro_proc_work()) def launch_process(ctx): p = ctx.Pool() try: p.apply(do_coro_proc_work) except RuntimeError as e: print("Caught runtime error: {}".format(e)) else: print("Process exited with no error") @asyncio.coroutine def do_work(): ctx = multiprocessing.get_context("fork") print("Trying forked process") launch_process(ctx) print("Trying spawned process") ctx = multiprocessing.get_context("spawn") launch_process(ctx) if __name__ == "__main__": loop = asyncio.get_event_loop() print(loop) loop.run_until_complete(do_work())