Having trouble running Application within another running loop... #3310
-
Hi there, So far I have managed to use Bot.get_updates() then update the Application.update_queue but when I try to run Application.start() I get a RuntimeError: In order to initialize the Application outside of the run_poll() context, I have manually used:
Which seems to execute. I hope this makes sense, I'll be happy for any advice you can provide. Best |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 9 replies
-
Hi, glad that you like the library :)
and blocks the event loop until the user sends a stop signal. The last part is what makes |
Beta Was this translation helpful? Give feedback.
Hi, glad that you like the library :)
Application.run_polling
is purely optional. It's bascially a thin wrapper that runsApplication.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.