'How can I get bot to auto-run at a certain time, or when a certain condition is satisfied?

I'm building a basic Instagram bot, and it got me wondering, how could I get to auto-run at a certain time, or when a certain condition is satisfied (eg. when there's a new file in a folder)?

Help much appreciated.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source