Running programs from multiple .script files from a main program

I want to have a program that runs different scripts from different files.
I would really appreciate your suggestions and help.

example:

def main_program():

if (condition_1):
execute_file_1()

elif (condition_2):
execute_file_2()

elif (condition_3):
execute_file_3()
end

end

The subroutine call is what your are looking for.

Use a switch statement to call the cases. Example from my own systems.

image

@WattsUp
Thanks for the quick reply.
But I’m not so sure if the subroutine is what I’m looking for.
When I’m saving a program into .script the subroutine takes my other file and copies its content in the main program.
As if under the hood it’s still a single file.

To give a bit more context:
I’m trying to write a custom .script driver file.
My problem is that I have two files that control different tools with shared variables with different values.

also, I want to have a script that dynamically calls different files with a string as an input.

Thanks in advance for your suggestions

You are correct that the subroutine just appends that to the main file.

you can write those subroutines and then take the .script file itself and load it as a script call.
I have never tried that, but it might allow that variability. I think it still appends to a single file though.