I'm not very experienced yet but I can share a few ideas here. First, are you using the VSCode terminal ? You could try using the real one. If you don't know how to : run cd /pathtoyourfolder/, and it should change the working directory into your selected folder. Then, activate your venv by: source .venv(or path if it isn't in the working directory)/bin/activate. Then run the file by: python3 nameofthefile.py . I do this in the real Terminal, but you can as well run this in the VSCode integrated one. Check that the venv is activated: (.venv) before the name of the working directory.
PS : I remember the fact that in my very first scripts I selected something like {run selection line}, and it printed the file in the terminal and I had to press return and invoke the function, but that was because there wasn't a main function that ran. Could you precise what type your file is ?