Ask Your Question

Revision history [back]

Create a text file with a .py or .sage extension, put in that file the code you want to reuse, and then load, runfile or attach that file in the Sage notebook worksheet (.sws) or SageMathCloud Sage worksheet (.sagews) or Jupyter notebook worksheet (.ipynb).

So for instance, in your SageMathCloud project, create a file mycode.sage, put in that file all the functions you want to reuse (you can copy-paste them from your initial .sagews worksheet), and then open a worksheet, say either playwithmycode.sagews or playwithmycode.ipynb (in that case select the Sage kernel from the Kernel > Change kernel menu item), and there you can load or runfile or attach mycode.sage and use all the functions that are defined there.