Problem importing with virtual environment on Mac

Hello!

I recently watched the video about how to start using virtual environments with Python to better organize your code.

Video Link

I can import everything properly, and can import libraries in the virtual environment’s python interpreter. The second I try and import those same libraries in a python file, I get all sorts of import errors that say the module does not exist, despite being in the same folder as the virtual environment.

Am I not running the file properly? Is there some other way that might fix this?

Any help would be appreciated.

How are you running the files themselves?

I’m using Visual Studio Code, so I initially just clicked the green arrow that “ran” the file. I’ve also tried running it in both the virtual environment’s shell and the python interpreter, but neither of those are working for me.

It’s definitely worth checking the docs for VS Code, it has some degree of automation for this which may or may not (if you’re unfamiliar with it) make things easier-

Note for example the image which shows the status bar notification of which environment and interpreter are currently active.

Thanks so much! I’ll check this out!