I am familiar with calling external python programs from another python program.
Psudocode to declare the code structure, goes like this:
#MAIN PROGRAM
import secondary
#...
is_OK = secondary.wrapper_function(param1, param2)
if is_OK == "0":
#do_something
and the external python program:
#SECONDARY PROGRAM
import lib1
def wrapper_function(param1, param2):
myparam = param1 #get parameters
#do_stuff
return "0"
As you can see, we pass the parameters to the function.
However, in my case now, the python script that i want to call, receives its parameters from flags.
This is how you would call it.
python my_program.py --parameter1 "0.4" --parameter2 "none"
The program handles the flags with something like this:
parser.add_argument(
"--parameter2",
type=str,
default="grid",
choices=[
# All choices are listed here
],
help="defines a major parameter",
)
I can place the code in the external program in a function, in order to call it from the main program.
My question is, how do i pass the parameters that the external program receives as flags from the terminal?