Calling UDF functions in Notebook from git


I have a notebook at . I want to call UDF functions in notebook (while running it on Binder) which are saved in the repository as .py file. How can i call those functions. An example function is uploaded.

Any thoughts how can i accomplish this.


Go to

Once the session launches, open a new notebook.

Paste the following into a cell:

import testpy as t

The function will return the expected result.

One thing to look out for though is that import won’t reimport the file even if it had been changed since the first time it was imported into the environment when it first encountered the import call. Restarting the notebook kernel after a change is one work-around. You’ll want to read here and decide what works for you if the file containing the user-defined function will be edited during the session.

Thanks for the reply. It is as simple as you have mentioned. I guess re-importing was the problem.

1 Like