How to change context in the middle of form

How to switch context in the rasa forms, eg: when i am booking one restaurant bot will ask for the no of seats. instead of entering the input i ask some other questing like “show me weather in kolkata”

What do your slot mappings look like? If you restrict the mapping of your required slots to a certain intent, if a different (chitchat) intent is picked up, it should exit the form and let other policies make action predictions. Which version of SDK are you on?

You need to handle unhappy paths for that. More info can be found in the documentation: Slot Filling

Here is a quick example on how to do it, this example deactivates the form when calling another intent. If you want to get back to the form after the question has been answered look in the documentation:

Story file:

## story - unhappy >> greet
* example_form
 - example_form
 - form{"name": "example_form"}
* greetings.hello OR greetings.goodevening OR greetings.goodmorning OR greetings.goodnight
 - action_greet
 - action_deactivate_form
 - form{"name": null}

Actions (on slot mapping):

def slot_mappings(self):
    return {"seats": self.from_text(
                not_intent=["greetings.hello", "greetings.goodevening", "greetings.goodmorning", "greetings.goodnight"])}

As you can see it will map to seat any text that is not one of those intents.