I want to make a notebook that contains some functions, then use those functions in other notebooks. I have not been able to figure out how to import a function for one notebook into another? I tried:
%run test_function.ipynb
but get this message: Exception: File `'test_function.ipynb.py'` not found.
The notebooks are in the same "Folder" in ArcGIS online. I would like to know how to import functions for notebooks in the same folder and in different folders.
Thanks!
Folders in ArcGIS Online are not the same as folders on your computer.
I don't believe it's possible to call functions from one notebook in another notebook in ArcGIS Online. Each notebook operates independently and you would need to copy the functions/code from one notebook to another.
I believe the only real interaction is executing another notebook:
https://developers.arcgis.com/python/latest/api-reference/arcgis.notebook.html#execute-notebook
If you have a lot of notebooks and functions used across them you could consider embedding the functions as a script file and then writing a python notebook that downloads the notebook, replaces the script file and then replaces the notebook in ArcGIS Online (effectively maintaining functions across multiple notebooks).
Thank you for your suggestion. That is an interesting idea.