Skip to content

Having trouble running Application within another running loop... #3310

Answered by Bibo-Joshi
tumma72 asked this question in Q&A
Discussion options

You must be logged in to vote

Hi, glad that you like the library :)

Application.run_polling is purely optional. It's bascially a thin wrapper that runs

  • Application.initalize
  • Application.start
  • Application.updater.start_polling
  • Application.updater.stop
  • Application.stop
  • Application.shutdown

and blocks the event loop until the user sends a stop signal. The last part is what makes run_polling unsuitable when combining PTB with other asyncio frameworks. In that case, you can just manually call the methods. See also this example, which showcases this in the context of setting up a custom webhook.

Replies: 1 comment 9 replies

Comment options

You must be logged in to vote
9 replies
@jnxyatmjx
Comment options

@Bibo-Joshi
Comment options

@jnxyatmjx
Comment options

@jnxyatmjx
Comment options

@Bibo-Joshi
Comment options

Answer selected by tumma72
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants