Timer in Python

I encountered a situation where I had to check if a function is running for a certain time. The below method called ‘after’ was very useful. This registers an alarm callback that is called after a given time.

Syntax : after(delay_ms, callback=None, *args)