Here is function:
def runaction(ENV, action_list):
appmanage_list = ['status']
for action in action_list.keys():
print('Action: %s' % action)
if action in appmanage_list:
from lib import appmanage_functions
a = appmanage_functions.AppManage(ENV)
a.[SOMETHING_GOES_HERE](ENV)
It's called like:
runaction(env, main_f.opts2)
action_list (main_f.opts2 argument in function call) - is dictionary from argparse with {'optionname':True};
appmanage_list - will include all options, which need to be call with code above;
action - options name, same as method from appmanage_functions.AppManage class, need to be called.
In place of [SOMETHING_GOES_HERE] I want add action variable, to call appropriate method from class.
I tried something like:
(a. + action + (ENV))
and:
a.('%s' % action)(ENV)
But sure - this not works...
Python 2.7