I have the same problem with Windows 11 and Python from M$ Store. This might be related to permissions: the user has no execute rights for python.exe, nor for python3.exe . Only python3.10.exe is executable. I did not succeed messing with access rights in the "C:\Program Files\WindowsApps\" folder, nor with Apps > Default Apps in Control Panel, but solved it with Far Manager:
In F9 -> Commands -> File associations
create an association for *.py to be executed with python.exe . Then you can just press Enter on Python files to run them and get execution results in the same console.
╔══════════════════════ Edit file associations ══════════════════════╗
║ A file mask or several file masks: ║
║ *.py ↓║
║ Description of the association: ║
║ Python3.10 M$Store ║
╟────────────────────────────────────────────────────────────────────╢
║ [x] Execute command (used for Enter): ║
║ C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3 ║
║ [x] Execute command (used for Ctrl+PgDn): ║
║ ║
║ [x] View command (used for F3): ║
║ ║
║ [x] View command (used for Alt+F3): ║
║ ║
║ [x] Edit command (used for F4): ║
║ ║
║ [x] Edit command (used for Alt+F4): ║
║ ║
╟────────────────────────────────────────────────────────────────────╢
║ { OK } [ Cancel ] ║
╚════════════════════════════════════════════════════════════════════╝
The full command is
"C:\Program Files\WindowsApps\PythonSoftwareFoundation.Python.3.10_3.10.3056.0_x64__qbz5n2kfra8p0\python3.10.exe" !.!