Search code examples
pythonbotstelegraminfinite-looppython-telegram-bot

Telegram bot Python, how to send message to certain users when another event triggered


I already have a script which checks my gmail inbox and twits the certain mails at certain intervals, for this i use a while True loop to have it run infinitely.

When i want to apply the same thing into a Telegram bot:

bot.polling() takes precedence over while True loop, or the the other way around. How to keep my while True loop running in a Telegram bot while the other functions of the bot without being interrupted?


Solution

  • No answer came in as yet, however i found a transient solution. I've made use of threading library and put the '''bot.polling()''' into o function and called this function in a thread. Basically, multithreading has resolved my issue.