Forums

Start a script forom another

hey, I want to start a py script using another in your platform

example:

import subprocess input_utente = int(input("Inserisci un numero: ")) if input_utente > 5: subprocess.run(["python3", "a.py"]) else: subprocess.run(["python3", "b.py"])

how can I do it on pythonanywhere platform? Can a script "talk" to another script and to a txt in python? thanks!

(sorry for the indentation but it make it look like an only line automatically)

You can do it just like that, though you need to specify the full path to the executable if you do not pass the shell=True argument to subprocess.run.

What do you mean by "talk"?