code: def needsattached(func):
      
  
      @functools.wraps(func)
      def wrap(self, *args, **kwargs):
        if not self.attached:
          raise PositionError('Not attached to any process.')
        return func(self, *args, **kwargs)
      return wrap
docs: Decorator to prevent commands from being used when not attached.