ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 07 Mar 2017 13:34:02 +0100[RESOLVED]Use sage objects in python module fileshttps://ask.sagemath.org/question/36850/resolveduse-sage-objects-in-python-module-files/ Hello,
I'm trying to figure out how to use sage functions/classes in a module .py file, from another python file.
Here's the thing, I'm developing a small simulator in Python 2 intended to be use with sage for solving diff. equations, etc...
So I have different .py files (interface, calcul, etc) in which have been written some code using sage functions.
Let's say I have "y = var('y')" in calcul.py and I run it from sage console ->
sage: load("calcul.py")
sage:
All works properly without any failures.
But, if I want to import this module in interface.py and then run the file with sage, I get this error ->
sage: load("interface.py")
---> 1 y = var('y')
NameError: name 'var' is not defined
As if it didn't recognize its own functions.
Is there any command/function to use in sage to allow loading of imported files without that type of error ?
Thanks in advance for your help.
HyorvennTue, 07 Mar 2017 13:34:02 +0100https://ask.sagemath.org/question/36850/