First time here? Check out the FAQ!
answered 8 years ago
You can save your file with the .sage extension and then load it in Sage using load('myfile.sage'). Then, your function should work as you have written it.
.sage
load('myfile.sage')