Send response when the global flag will set to True?

I have got two functions. The first one

def check_data_status():

is checking data status and setting global flag isSuccess to True.
The second one is response handler def new_answer(request):. But the second one should complete response(answer) only when first one will set flag isSuccess to True.

How I can organize it in code?

I am not at a computer to be able to give you a proper code snippet… so I apologize.

I would use asyncio.Event as the global variable. Set it when the task is done, and have the handler wait for it to be set.