Ask Your Question

Hyorvenn's profile - activity

2017-03-12 12:27:44 -0600 answered a question [RESOLVED]Use sage objects in python module files

Thanks a lot for your answers !

2017-03-11 09:22:49 -0600 received badge  Scholar (source)
2017-03-07 08:46:28 -0600 asked a question [RESOLVED]Use sage objects in python module files


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 and I run it from sage console ->

sage: load("") sage:

All works properly without any failures. But, if I want to import this module in and then run the file with sage, I get this error ->

sage: load("") ---> 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.