I answered a similar question in this post. The basic jist of the idea is to embed both functions into a Python class, then pass the relevant class functions to the necessary Nengo ensembles or nodes in your Nengo model.
I answered a similar question in this post. The basic jist of the idea is to embed both functions into a Python class, then pass the relevant class functions to the necessary Nengo ensembles or nodes in your Nengo model.