Can I use slotset and dispacher.utter_template in the same action

Hi ,

I have the following action-

class ActionGrowthReport(Action):
   def name(self):
      # type: () -> Text
      return "action_growth_report"

   def run(self, dispatcher, tracker, domain):
      # type: (Dispatcher, DialogueStateTracker, Domain) -> List[Event]

      my_period = tracker.get_slot('period')
      my_bucket = tracker.get_slot('bucket')
      result = random.uniform(-0.3, 0.3) #eventually i will query the result from DB
      SlotSet("growth_amt", result if result is not None else [])
      if result > 0.0:
         dispatcher.utter_template("utter_growth_up", tracker, growth_amt=result, period=my_period)
      if result < 0.0:
         dispatcher.utter_template("utter_growth_down", tracker, growth_amt=result, period=my_period)
      # return [SlotSet("achieve_amt", result if result is not None else [])]
      return []

This works fine . As in the utter_growth_up/down is uttered with the the correct growth_amt. But the slot growth_amt doesn’t get filled even if I use

SlotSet("growth_amt", result if result is not None else [])

So I can’t use it in further conversations. On the other hand if I use the commented out return statement-

return [SlotSet("achieve_amt", result if result is not None else [])]

The slot is set but the bot does not utter utter_growth_up/down

Is there a solution where the slot gets set and the bot utters the utter_template?

Thank you, Shruti

You have to return the SlotSet event, but you can still do dispatcher.utter_template too.