vtkOutputWindow

I’m using a python code that hides paraview error by using the following:
no_op_output_window = NoOpOutputWindow()
vtk.vtkOutputWindow.SetInstance(no_op_output_window)

in which :

Define a no-op vtkOutputWindow class

class NoOpOutputWindow(vtk.vtkOutputWindow):
def init(self):
super().init()
self.error = False # Variable to indicate if output was received
def DisplayText(self, text):
self.error = True

so when there is an error , there would be no pop up window (this part works) and no_op_output_window.error=True (this part doesn’t work).
How should I make no_op_output_window.error=True when there is an error?