You will have to learn how to use the threading module (or subprocess, although not preferred).
A hacky way to get out of learning threading would be to keep track of time in your script.
- Specify the rate of the timer, let’s say 10 seconds.
- Grab the initial time at the start of the script using the time module. (outside of any loop)
- Grab the current time inside the while loop.
- Test to see if (current_time - initial_time) is equal to or greater than the rate.
- If so, display the message and reset the initial time.
These are the Python 2.7.X docs for the modules I talked about:
Threading: https://docs.python.org/2.7/library/threading.html
Time: https://docs.python.org/2.7/library/time.html
Subprocess: https://docs.python.org/2.7/library/subprocess.html