Delay function for ESP 32 with Python

Hi , I am using a ESP 32 and a ultrasonic sensor to activate a doll if some one comes near by. I also would like to activate from Iphone and Google Home. The doll activation needs a delay function between the activation and sensing due to mechanical stability. Blynk gets disconnected with the delay. I understand why. I am using python for the whole project. Do we have a code to incorporate delay function while stay connected with the Blynk. Once sensed or activated through blynk, I need about 2 mins of delay before the next activation. That is the time doll takes to come back to rest. If there is no sensing , the void loop can be run without delay. The issue comes when there is a sensing and the doll need to be activated.