How to run a function in the background of flask app

Solution
def run_func():
    data = { 'some': 'data', 'any': 'data' }
    thr = Thread(target= *your_function*, args=[app, data])
    thr.start()
    return thr