ASKSAGE: Sage Q&A Forum - Latest question feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Mon, 02 Nov 2020 17:49:22 -0600Creating a file for user defined functions using JupyterLab environment.https://ask.sagemath.org/question/54105/creating-a-file-for-user-defined-functions-using-jupyterlab-environment/I want to create a function in a separate file, and use that function in another one.
Here is the example:
#my_file.ipynb
def my_function(n):
return n*2
#main.ipnyb
attach('my_file.ipynb')
my_function(2)
But when doing this at the JupyterLab I receive the following erros:
(1) ValueError: unknown file extension '.ipynb' for load or attach (supported extensions: .py, .pyx, .sage, .spyx, .f, .f90, .m)
(2) NameError: name 'my_function' is not defined
This method seems to work for ***.sage*** files, but is not working for ***'.ipynb'***.
There is some way to accomplish the result demonstrated through my example using only JupyterLab environment?OshioMon, 02 Nov 2020 17:49:22 -0600https://ask.sagemath.org/question/54105/