code: def on_api_error(self, error_status=None, message=None, event_origin=None):
  
          
          if message.meta["error"].find("Widget instance not found on server") > -1:
              # widget is missing on the other side, try to re-attach
              # then try again
              error_status["retry"] = True
              self.comm.attach_remote(
                  self.id,
                  self.remote_name,
                  remote_name=self.name,
                  **self.init_kwargs
              )
docs: API error handling