Skip to content

How do I use async methods without async for __init__ method? #3775

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

You must be logged in to vote

PTB is asyncio-only as of V20. You can probably use asyncio.loop.run_until_complete to your advantage or define a coroutine methods intialize for your wrapper class that is used for any I/O related initialization. The latter approach is also what the PTB classes likr Bot & Application do: https://docs.python-telegram-bot.org/en/stable/telegram.bot.html#telegram.Bot.initialize

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by CanavarB
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants