Call python class method with 'self' argument from mu

I’m trying to call a class method which requires the ‘self’ argument from mu. There is good documentation for this here: calling-python-from-mu.

However, this example seems to not work in RV 7.6.1. The lines with ‘ModeManagerMode’ and ‘PyMinorMode’ are syntax errors, these types seem to not be recognized. Does anyone know how the same can be achieved in RV 7.6.1?