There is absolutely no information in the screenshot you provided that indicates how you are running the file.
However, Python files need to be executed by a Python interpreter, which is normally achieved with e.g.
python /path/to/script.py
If you’re trying to run it directly as a shell script then the script file would need to contain e.g.
#!/usr/bin/python
print("This might actually work");
and then you can use e.g.
chmod u+x script.py
./script.py
None of this is related to KDE - it’s all just “user error”.