How can I make a script run forever? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

How can I make a script run forever?

I am making a discord bit with python and the bit keeps going offline when I close the text editor and wait till the next morning it's offline. I believe I need to make the script run forever but if so how so I do that? If that's not what I need to do please tell what I do need to do? Don't know if it will help but the bot is coded in python.

13th Aug 2020, 11:54 AM
ChickenTendies
ChickenTendies - avatar
3 Answers
+ 3
self hosting ? yeah dont run the script from text editor, the trrminal used by text editor attach itself to it as a child, thus will close when the parent/editor are closed. just open a new cmd/terminal yourself then run the script from there. you can leave it minimized
13th Aug 2020, 12:12 PM
Taste
Taste - avatar
0
Taste would I need to leave the cmd or can I close it? And what what I type in the cmd terminal to run it?
13th Aug 2020, 9:11 PM
ChickenTendies
ChickenTendies - avatar
0
you cant close it, it close along with the bot. to run it go to your project directory then type python main.py main.py could be any file you're using as the entry point
13th Aug 2020, 9:17 PM
Taste
Taste - avatar