answered 5 years ago
You can declare a as a global variable:
a
def test2(): global a a=1 load("test.sage")
Remember that SageMath now is based on Python 3, so you should write print(a) if you use SageMath 9.0.
print(a)