Ask Your Question

Revision history [back]

In the file ~.sage/init.sage, you may write the following code:

import os
if os.path.exists('init.sage'):
    %runfile init.sage

which will automatically run the file init.sage if there is such a file in the current folder.

Then, you can put your desired code in that file in your working directory which will get run when you start sage.

In the file ~.sage/init.sage, you may write the following code:

import os
if os.path.exists('init.sage'):
    %runfile init.sage

which will automatically run the file init.sage if there is such a file in the current folder.

folder. Then, you can put your desired code in that file in your working directory which will get run first when you start sage.