The console in Sublime is the console for the internal Python interpreter that’s used to run the plugin system. It is in every way divorced from any version of Python that you might have installed on your computer (including if you have no Python installed at all).
To do something like what you want you need to be able to run an external Python program and then tell the interpreter to go interactive at the end. You can’t run interactive programs directly within Sublime because the input that you type in the output panel doesn’t get sent back to the running program; hence any program that asks for input will hang indefinitely because you have no way to talk to it.
The general solution is to use something like SublimeREPL or Terminus to make a build system that runs the script and then goes interactive at the end allowing you to interact with the program. My general recommendation would be to use Terminus for something like this.
There is a video excerpt that goes over how you would create a sublime-build
that uses Terminus
to run an interactive program. In your case the resulting sublime-build
file would look the one below.
This playlist contains several videos that talk about how Build Systems work in general if you’re unfamiliar with the concept. The excerpt linked above is from an upcoming video on this particular topic.
{
"target": "terminus_open",
"cmd": ["python", "-i", "-u", "${file}"],
"working_dir": "${file_path}",
"auto_close": true,
"selector": "source.python"
}