Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

How to specify the value of variables in a file to be loaded

Hello,

I encountered the following problem. When I a write a file test.sage with one line:

print a

in the terminal I define a function,

def test2():
   a=1
   load("test.sage")

When I run test2() in the terminal, I get the error message

NameError: name 'a' is not defined

My question is, how do I specify the value of a in test.sage when I load it?

Thanks in advance!