类中的异步函数 - 从另一个文件调用它?

时间:2021-03-10 12:07:58

标签: python sql asynchronous async-await

我有一个包含我使用一些 SQL 的项目,我想知道如何调用 DB 文件中的函数?

class testing_db(commands.Cog):
    def __init__(self, bot):
        self.bot=bot
    async def create_db_pool():
        conn = await asyncpg.create_pool(database="db", user="user", host="nunyabusiness", password=DB_PW)



    async def get_account_id(other_id):
       mhm = "Do whatever I do here (I know how to do it but not call it from another file)"






    loop.run_until_complete(create_db_pool())

def setup(bot):
    bot.add_cog(testing_db(bot))

0 个答案:

没有答案