import multiprocessing def run_plot_task(task): func, args = task return func(*args) def run_plot_tasks_parallel(plot_tasks): ctx = multiprocessing.get_context('fork') with ctx.Pool() as pool: pool.map(run_plot_task, plot_tasks)