I have a file with some commands that loads some other files and runs just fine from within an interactive sage session. But when I try to run it via sage filename on the command line I get errors of the form 'Integer undefined in file$junk.py'. where file.sage is one of the imported files.
Adding in the necessary import statements according to import_statements() to file.sage doesn't seem to fix this, nor the code loading it. Looking at the generated python it appears that the constant definitions are getting moved up beyond the import statements, and thus break the script. (There is an inserted massive import statement at the right place of sage.cmdline_all.*, but it doesn't seem to include Integer). I will try to make a minimal test-case to see if this is indeed happening.
I hope I don't need to resort to expect to get this code to run without my personal intervention. It's very likely I am doing something badly wrong, and if so would appreciate knowing how to do this right. (Documentation was not much help)
Sincerely,
Watson Ladd