Ask Your Question

Revision history [back]

If you put things in a .py file suddenly you need to import everything properly.

To know what import statements to write, import_statements is your friend.

Use the import_statement function in a Sage session to figure out the imports.

For instance:

sage: import_statements(point)
# ** Warning **: several names for that object: point, points
from sage.plot.point import point

sage: import_statements(var)
from sage.calculus.var import var

and so on.

Place the corresponding imports near the start of your .py file.

So it will now start:

from sage.calculus.var import var
from sage.plot.point import point

etc.

If you put things in a .py file suddenly you need to import everything properly.

To know what import statements to write, import_statements is your friend.

Use the import_statement function in a Sage session to figure out the imports.

For instance:

sage: import_statements(point)
# ** Warning **: several names for that object: point, points
from sage.plot.point import point

sage: import_statements(var)
from sage.calculus.var import var

and so on.

Place the corresponding imports near the start of your .py file.

So it will now start:

from sage.calculus.var import var
from sage.plot.point import point

etc.

For more in-depth discussions, see previously asked questions here or elsewhere. For instance, search import_statements on Ask Sage:

and visit the various results of that query.