Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Sage is not updating modules imported by an attached file

My file structure looks like:

project/ looks approximately like:

import sys
import os

import bounds

def myfunction(g):
    if has_bound(g):

def has_bound(g):
    lbound = 1
    for name, obj in inspect.getmembers(bounds, inspect.isclass):
        if obj.__module__ == 'bounds':
            new_bound = obj.bound(g)
            if new_bound > lbound:
                lbound = new_bound
    return lbound

import abc

class BoundBase(object):
    def bound(g):

class SpecificBound(LowerBoundBase):
    def bound(g):
        return 5

Now, I start a Sage session in the Terminal and do attach I can even make changes in and see the results immediately in Sage. The problem is that if I change something in, Sage won't pick up on the changes. I've tried combinations of reset(), detach(), attach(), load(), but the only thing that works is quitting Sage completely and restarting it. There must be a better way!