hey @stephens i mean to say like i want to retrive action inside another action means i will have all the action inside action.py file and for few case like i want to execute
my action like below example:
class AreaAction(Action):
def name(self):
return “action_area”
def run(self, dispatcher, tracker, domain):
ar = tracker.get_slot('area')
buttons = []
mov = tracker.get_slot('movie')
for i in moviez:
moviename = i['@name']
if (moviename.casefold() == mov.casefold()):
Theater = i['Theatre']
try:
for j in Theater:
cinema = j['@name']
buttonsz = [{"title": cinema, "payload": '/area_byuser {"area": "' + cinema + '"}'}]
buttons.extend(buttonsz)
dispatcher.utter_button_message("May i know where you would like to watch movie, Please select to proceed ", buttons)
except:
cinema = Theater['@name']
buttonsz = [{"title": cinema, "payload": '/area_byuser {"area": "' + cinema + '"}'}]
buttons.extend(buttonsz)
dispatcher.utter_button_message("Movie is available only on ", buttons)
like the above example i have try and expect for both case m returing some buttons in dispatcher but instead of that i want to return action inside dispatcher(like the action will be something which is present in the action.py file so how can i do that )
i want to return action inside dispatcher(like the action will be something which is present in the action.py file so how can i do that )
I think you’re asking a Python question or maybe a dispatcher question. You can find the dispatcher and it’s available methods here.
If you want to call one of the dispatcher methods and pass another method as a parameter, then that method would need to return a value of the correct type. Something like this: