I'm new and I'm trying to run a script that runs a sequence of scripts based on what I put in a text file.
For example, I have Script1.py
with print("Script1")
... then Script2.py
with print("Script2")
, Script3.py
with print("Script3")
... and in the text file to once:
Script1.py
Script3.py
then another time to have:
Script2.py
Script1.py
Script3.py
Script2.py
And the main script to execute the sequence of scripts in the text file.
PS: Apologies for my English language
Thank you in advance
def Script1():
Script1.py
def Script2():
Script2.py
def Script3():
Script3.py
commands_table = {'Script1':Script1, 'Script2':Script2, 'Script3':Script3}
with open('test.txt', 'r') as command_file:
for cmd in command_file:
cmd = cmd.strip()
commands_table[cmd]()