Solved by googlebot in post #2 
              
              
                you need @staticmethod before forward and backward, i.e. these custom functions are not used with 
self : Function (instance), instead special context object is passed as first argument, basically look at example in docs