def METHOD_NAME(
    self,
    widget_state: WidgetStates | None = None,
    timeout: float = 3,
) -> ElementTree:
    """Run the script, and parse the output messages for querying
    and interaction."""
    rerun_data = RerunData(widget_states=widget_state)
    self.request_rerun(rerun_data)
    if not self._script_thread:
        self.start()
    require_widgets_deltas(self, timeout)
    tree = parse_tree_from_messages(self.forward_msgs())
    tree.script_path = self.script_path
    tree._session_state = self.session_state
    return tree