As suggested by @Joshua, you can use SublimeREPL. Alternatively, if you want to solve it with a custom build system, you should make a build system that executes the python script through an external terminal (as the output panel in Sublime only displays output, without listening to input). Most terminal applications have an option to execute a provided command. For instance, if you use terminator for your terminals, you can use the following build system:
{
"shell_cmd": "terminator -p sublime -e \"python -u $file; echo [Finished with exit code \\$?]\"",
"file_regex": "^[ ]*File \"(...*?)\", line ([0-9]*)",
"selector": "source.python",
}
It executes your python script in a terminator terminal. The sublime
profile provided through the -p
option is a custom terminator profile with the When command exists - Hold the terminal open
-option enabled.