I have a wrapper function that runs multiple subroutines. Instead defining the wrapper function to take hundreds of inputs that would pass to each subroutine, I would like the wrapper function to read an input file containing all the arguments to be passed to each subroutine.
For example, given an input file called eg_input.py:
## example of argument file
a = [1]
b = [2]
c = [3]
d = [4]
e = [5]
f = [6]
I'd like to have a wrapper function that looks something like this:
def wrap_fun(argument_file):
    
    ## read in the argument file
    exec(open(argument_file).read())
    ## run first sub routine
    sub_fun1(fun1_parma1=a, fun1_param2=b, fun1_param3=c)
    ## run second sub routine
    sub_fun2(fun2_param1=d, fun2_param2=e, fun2_param3=f)
    ## run third sub routine
    ## note some arguments are shared between subroutines 
    sub_fun2(fun3_param1=a, fun3_param2=f)
    
    ## etc...
    return()
such that I could run a script like:
wrap_fun(eg_input.py)
When I run code similar to the above, however, the arguments are not available to the subroutines.
You'll note I used the exec() function in the above example but I am not adamant about using it, i.e. if there is a pythonic way to accomplish this I would prefer that solution.
My motivation for this question is the ability to easily produce a variety of input files (again with each input file containing 100s of arguments) and observing how changing each argument affects the results of wrap_fun().
Thanks!
 
    