Sagemath in multiple files
Greetings!
I am migrating my applications from "pure python" to sagemath. If I use any sagemath functions in python modules, they dont work... I tried the "from sage.all import *" , but it works only partially.
e.g. I can use x = var('x') but not R.<x> = QQ[]
I tried to write my code in multple notebooks and import them as modules in the main application - with import_ipynb, but changes are recognized only with kernel restart (even with using autorelod). So this approach is not very efficient for development.
Is there any efficient way to split my app in multiple files/modules? or it has to be written in a single notebook? (we talk about thousands of lines).
Thank you
This is because of the preparser, which is turning some sage-specific constructions into correct python code. See https://doc.sagemath.org/html/en/refe...
If you name your files with extension “.sage” instead of “.py”, Sage should preparse them automatically.
Alternatively, you can
attach myfile.sage
Thanks everyone. You have been very helpful. Really appreciated!