How can I have multiple files run using python?

How can I have multiple files run using python?

Currently, It only runs main.py

I am trying to make it run the bot 1.py, bot 2.py, and bot 3.py

https://replit.com/@TheC0ders/City-Sim#main.py

Try this bash script

python bot1.py &
python bot2.py &
python bot3.py
4 Likes

I’m not that experienced. What is a BASH script?

Make a run.sh and put the code inside. Then run sh run.sh in shell

4 Likes

It says “No such file in directory”

Never mind. I forgot the capitalisation.

1 Like

It says that the bot1.py, bot2.py and bot3.py don’t exist in the directory.

I just checked your repl, and two things are wrong

  1. Your capitalization in the names is wrong
  2. You cannot have spaces in the names, and spaces in names is generally bad programming practice.
3 Likes

I fixed that. It works now! Thank you so much!

2 Likes

This has some information on what Bash is
BTW it’s not a Bash “script”, just Bash

If you find Wikipedia intimidating, this is better

3 Likes

Well, bash scripts are what bash runs. So both would work in this context

4 Likes

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