(self)
Detaches this entity if it has previously been attached.
Detaches this entity if it has previously been attached.
Detaches this entity if it has previously been attached .
def detach(self):
    """Detaches this entity if it has previously been attached."""
    if self._parent is not None:
      parent = self._parent()  # pylint: disable=not-callable
      if parent:  # Weakref might dereference to None during garbage collection.
        self.mjcf_model.detach()
        parent._attached.remove(self)  # pylint: disable=protected-access
      self._parent = None
    else:
      raise RuntimeError('Cannot detach an entity that is not attached.')
def detach ( self ) : if self . _parent is not None : parent = self . _parent ( ) # pylint: disable=not-callable if parent : # Weakref might dereference to None during garbage collection. self . mjcf_model . detach ( ) parent . _attached . remove ( self ) # pylint: disable=protected-access self . _parent = None else : raise RuntimeError ( 'Cannot detach an entity that is not attached.' )