I have two files;
The first file,
myProgram.py
, is a python file with a number of functions
one of the functions contained inside ismyFunction
this function would be called withimport myProgram myProgram.thisFunction() myProgram.thatFunction()
The second file contains a menu system, with calls to the functions in
myProgram.py
I'd like to call a particular function based on an argument passed to a function in file2
def file2_function(function):
myProgram.function
file2_function(thisFunction(x,y,z))
which would essentially create myProgram.thisfunction(x,y,z) and execute it.
I guess I could do this using a bunch of if/elif statements, say:
def file2_function(function):
if function == 1:
myProgram.thisFunction
elif function == 2:
myProgram.thatFunction
Though that could get messy as I'm already using a lot of if/elif/else statements for the menu system.
Is there a better way (or is the if/elif route the way to go?)