Thanks ,I used Auto-Lock in settings to 30-Seconds and used

console.set_idle_timer_disabled(True)

Untill the timer runs out and changed the flag to False.