code: def save_scenario(self):
          
          from safe.gui.tools.save_scenario import SaveScenarioDialog
  
          dialog = SaveScenarioDialog(
              iface=self.iface,
              dock=self.dock_widget)
          dialog.save_scenario()
docs: Save current scenario to text file.