I want to call a function from another script according to a string I pass in my current script. For example: I have different functions in Entry, I want to choose which one to run.
import Entry
def ma_exec(entry = 'longShort'):
if entry == 'longShort':
entryStrategy = Entry.longShort
entryStrategy(PositionTable, Signal)
But in this way I will have to write so many if for each different functions in Entry. Can I do something similar as:
def ma_exec(entry = 'longShort'):
entryStrategy = Entry.entry
So that I can run different functions according to the String value I pass to this ma_exec function? I know this line above is not right, is there a good way to solve my problem?