$config_path/User/globalStorage/.../state.vscdb  --> ms-python.python.
I want to update the selected python interpreter inside vs code from a script.
I tried:

.vscode/settings.json in the workspace allows setting python.defaultInterpreterPath but it works only once. Even if select "default interpreter" in the UI (e.g. python 3.8), close vs code, change the setting to 3.9, open vscode again, vs code remembers 3.8.
$config_path/User/workspaceStorage/.../state.vscdb also contains a key ms-python.python which got data for the selected interpreter autoSelectedWorkspacePythonInterpreter - but that does not even change when changing the interpreter in vscode (from the name of the setting that kind of makes sense)

Where does vs code even store the information which interpreter is selected by hand?
Any pointers welcome how to change the used python interpreter (preferable from a script running outsideof vs code, but I would also write a vs code extention if that is easier :))
Update selected python interpreter from script