# -*- coding: utf-8 -*- import time import functools import threading def async(func): @functools.wraps(func) def wrapper(*args, **kwargs): my_thread = threading.Thread(target = func, args = args, kwargs = kwargs) my_thread.start() return wrapper @async def foo(x, y): c = 0 while c < 5: c = c + 1 print x print y time.sleep(5) foo(1, 2) foo(4, y = 5)