Getting my own module to work in Sage
Hey everyone. I wrote a sage module that defines a couple functions that I'd like to be able to import into sage any time I want. From what I've researched, it seems the way to do this is save the file that defines the functions as a .py file, then put it into sage's version of python. I've done that, and sage imports the file just fine without errors, except when I attempt to call functions from the file in the sage prompt, it gets stuck on the first sage-specific function, in this case var(). I get this error message:
sage: polyv1.sift(4, 3)
---------------------------------------------------------------------------
NameError Traceback (most recent call last)
<ipython-input-20-d64cf99d698f> in <module>()
----> 1 polyv1.sift(Integer(4), Integer(3))
/usr/lib/sagemath/local/lib/python/polyv1.py in sift(r, s)
NameError: global name 'var' is not defined
I've tried adding 'from sage.all import *' to the beginning of the file, and it doesn't create an error, but it also doesn't fix the problem. Am I missing something really easy? How do you get sage to recognize the sage functions?