Think this is a bug of VS Code.
When you use “run selection/line in python terminal” command, VS Code starts python interpreter and doesn`t quit it after completion.
You should use exit()
command in python interpreter window to end python session.
After that “run python file in terminal” will work fine.