from threading import Thread def run_in_thread(fun): def wrapper(*args, **kwargs): thread = Thread(target=fun, args=args, kwargs=kwargs) thread.start() return thread return wrapper