ModuleNotFoundError: No module named 'flask_wtf'

Hello, I am trying to recreate a project from instructables.
I am starting a program from the commandline: sudo python3
I get the following message:
File “/home/pi/iotProject/”, line 1, in
from flask_wtf import FlaskForm
ModuleNotFoundError: No module named ‘flask_wtf’
When I run this program from within the Thonny Python IDE is executes oke, wityhout any error messages?
Anny suggestions what goes wrong?

I do not use Raspberry Pi hardware nor Thonny, but this surprises me:

Why do you prefix the command with sudo? It changes the environment. And, do you always run as superuser when you use Thonny?

Well, maybe the IDE is configured differently. If e.g. it uses Python2 as the interpreter, flask-wtf will only be available for Python2. Same applies for different versions (3.8 vs. 3.9, not minor versions) of Python3.

I used sudo as prefix, because it was shown in the documentation from the project I want to re-create.
But It has been solved now. I reinstalled the complete OS and the products needed, but I installed the Flask components using the instructions from the package. Not from the project I want to recreate.