I am using repl.it to run two bots in the same repl and I'm using imports as a I saw in other stackoverflow questions.
print('This will be the page where all bots will be made.')
import os
import bot1
import keep_alive
import bot2
import keep_alive1
while True:print('ALL BOTS STARTED!')
The problem is, it never gets to the while
loop (it's for testing) because it gets stuck in the bot1 file. How should I fix this? The reason I'm doing it in the same repl project is so I can merge the bot database.
You should not be using an SQLite or local database with repl.it. This is because when the containers do a restart you might lose some data (unless they have changed this over the years).
It is recommended to use a database like MongoDB which offers a free 500MB database for you to use.
Since you did ask a question, I will answer it. You could try this:
import asyncioloop = asyncio.get_event_loop()
loop.create_task(bot1.start("bot_token1"))
loop.create_task(bot2.start("bot_token2"))
loop.run_forever()
You would need to use cogs and have both bots set up in the main.py
then use cogs for better file management.