2020-06-18 21:35:22 +0100 | received badge | ● Popular Question (source) |
2017-03-12 18:27:44 +0100 | answered a question | [RESOLVED]Use sage objects in python module files Thanks a lot for your answers ! |
2017-03-11 16:22:49 +0100 | received badge | ● Scholar (source) |
2017-03-07 15:46:28 +0100 | asked a question | [RESOLVED]Use 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. |