Actually I met this issue a long time ago, the solution is to create a new Function object every time you use it, as I did in the module 49.  But as you mentioned, you can comment self.output and it seems to be useless in the function.