This is really easy, I'm pleased as punch that this actually works, I'd never tried it.
- Create a file. I made foo.sage, whose entire content is
g(x)=x^2
. I put it in my home directory. - Do
load("~/foo.sage")
, or whatever is appropriate for where your script lives. - Enjoy!
This should work with .py files as well. It's conceivable that you'll need appropriate permissions, etc.
If you have custom data to use as well, the best thing to do is see if the DATA
variable will do what you need. This is documented in the "Help" link at the top of the notebook, and it should be pretty easy to upload an appropriate data file there as need be.