Ask Your Question

Revision history [back]

I think if the source files are still changing, then staying with attach seems like a good idea. Once the source is stable, you can import everything using python's import -- to get this to work you just need a blank file __init__.py, and a file all.py listing what to import (maybe you don't need every function from every file). Taking a look at subdirectories of the Sage development directory will make this obvious. And you can also take a look at the python modules reference if you want, although it doesn't quite agree with what Sage seems to be doing.

In the meantime, the following will also work to attach all the .sage files in the current directory (although I don't really think it's much better than what you've been doing):

import glob
to_attach = glob.glob('./*.sage')
for f in to_attach:
    attach(f)