How to write a background thread in Python which will keep on calling a particular method every few minutes.
Let's say, if I am starting my program for the first time, then it should call that method right away, and after that, it should keep on calling that method every X minutes?
Is it possible to do in Python?
I don't have that much experience with Python threading. In Java I can use TimerTask
or ScheduledExecutors
for this problem but not sure how to do it with Python?
What's the best way to do this in Python?
Use
threading.Timer
.For example: