Running Nextcord (A Python wrapper for the Discord API forked from ) & Flask at the same time


I am trying to run a Flask app and to run Nextcord bot at the same time, same file.
I tried to use this gist but it doesn’t seem to work.
Are there any ways to solve this problem?

Thanks, Matan.

In what way does it not work? Please provide an error/exception


Two things:

  • First, the gist is for, not nextcord, so don’t expect it to magically work
  • Second, flask does have async support, and that would be a better solution.

Nevermind, I solved the problem using this code:

from threading import Thread
from quart import Quart
from functools import partial
from nextcord.ext import commands

app = Quart(__name__)
bot = commands.Bot()

bot.loop.create_task(app.run_task(host="", port=81, debug=True))"Your token")

I switched from Flask to Quart

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.