Ask coding questions

← Back to all posts
how to schedule a bash command?
h
ciziummango

hi,
I'm new to python and replit. I created the scheduler.py to run background schedule without halting the bot.
I use python scheduler.py to run it in shell. But it was reset and never kept running although my repl is "Always-on".
So, I'm wondering how can auto run this code python scheduler.py with scheduled time?
I do not want to put it in main.py because once I run the scheduler task, the main web funtion cannot be used as it waits for scheduler task to be completed.
So, I need to run it as a separate file...
Any idea or advices are appreciated. I have been searching allover the place and couldn't find the solution yet.
Thank you.

Voters
ciziummango
Comments
hotnewtop
ciziummango

I found the solution by myself last night and I'm pretty happy about it.
I just added this code in another file and call keep_alive() before client.run(). It works like a charm. Thanks so much to Beau Carnes's tutorial on how to code a bot. Below is my code that make it work to call scheduler.py auto whenever the repl is restarted.