Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Is there a way to prefix all sage code in order to include a custom module?

I have a library of commonly used functions and variables which I import, when required, into sage by using the following commands:

import os, sys
cmd_folder = '/home/username/sage'
if cmd_folder not in sys.path:
     sys.path.insert(0, cmd_folder)
import defaults as d

This allows me to access all my frequently used saved functions and variables. I essentially only use Sage through the web interface, and I would like to know if it is possible to make this code run as a "prefix" so that I no longer have to type this include in every worksheet.