I got a summary from Sebastian Pfitzner on slack.
Basically, VSCode will automatically use the environment of the (top) folder you opened in it. In my case, the top folder doesn’t contain an environment, and by script is in a subfolder, so the default environment is used. However, by right-clicking on that folder, I can select to use that environment instead.