Activating new form from the current form


Is it possible to activate a form from within the submit(…) method of another?

I’m in a situation where I have a form that takes input from user whether she is a new user or an old. If old, I want to take the old token-id from user and fetch from DB it’s details (this I’m doing in a separate form as there are still a few params to be taken from user). If new, start a different form and start taking all user details.

I tried using “tracker.change_form_to()” but it throws error saying Tracker has no such attribute.

I’m obviously doing something wrong here. Could you please help me sort this out.

This is the error stack trace :

E0822 03:05:24.006472  4244] Exception on /webhook [POST]

Traceback (most recent call last):

 File "c:\users\hp\anaconda3\lib\site-packages\flask\", line 2292, in wsgi_app
   response = self.full_dispatch_request()

 File "c:\users\hp\anaconda3\lib\site-packages\flask\", line 1815, in full_dispatch_request
   rv = self.handle_user_exception(e)

 File "c:\users\hp\anaconda3\lib\site-packages\flask_cors\", line 161, in wrapped_function
   return cors_after_request(app.make_response(f(*args, **kwargs)))

 File "c:\users\hp\anaconda3\lib\site-packages\flask\", line 1718, in handle_user_exception
   reraise(exc_type, exc_value, tb)

 File "c:\users\hp\anaconda3\lib\site-packages\flask\", line 35, in reraise
   raise value

 File "c:\users\hp\anaconda3\lib\site-packages\flask\", line 1813, in full_dispatch_request
   rv = self.dispatch_request()

 File "c:\users\hp\anaconda3\lib\site-packages\flask\", line 1799, in dispatch_request
   return self.view_functions[rule.endpoint](**req.view_args)

 File "c:\users\hp\anaconda3\lib\site-packages\flask_cors\", line 128, in wrapped_function
   resp = make_response(f(*args, **kwargs))

 File "c:\users\hp\anaconda3\lib\site-packages\rasa_sdk\", line 59, in webhook
   response =

 File "c:\users\hp\anaconda3\lib\site-packages\rasa_sdk\", line 245, in run
   events = action(dispatcher, tracker, domain)

 File "c:\users\hp\anaconda3\lib\site-packages\rasa_sdk\", line 549, in run
   events.extend(self.submit(dispatcher, temp_tracker, domain))

 File "C:\Users\HP\Documents\VBOT\vbot_chatbot_v2.6\", line 247, in submit
   return (Tracker.change_form_to("vbot_form_3"))

AttributeError: type object 'Tracker' has no attribute 'change_form_to'

Thanks Rahul

Hey there! You should be able to do this with stories and a featurized slot. E.g. if the slot is

      type: bool

then your stories could look something like

## returning user
* greet
  - user_form
  - slot{"is_new_user": false}
  - returning_user_form

## new user
* greet
  - user_form
  - slot{"is_new_user": true}
  - new_user_form

You’re not moving from one form to another, but the first form is setting a slot based on the user input of “yes” or “no” if they’ve used your product before. Then when the featurized slot is set, the stories will drive which form is chosen next.

Does that help?

Thank you Ella !

't has started working.

Glad to hear it!

Hi @erohmensing! Should these stories not be a “rule”? I’m just a bit confused as to when I absolutely NEED to use a story. Most bots could just work on well set rules as well as the (great) nlu entity and intent detection pipelines of rasa?