Like in an HTML page, just have a section that prints output from a python file that starts either on load or on input, and it could also take output somehow.
finding something similar has been annoying and i hate flask, and also this would be very useful.
The reason people use Flask or other annoying frameworks is mostly for security purposes: modern servers need a bunch of stuff for browsers to “trust” them and vice versa, and you’re generally not going to implement those yourself (because you might not even know about them).
There’s flask alternatives out there, but if you really just want some dumb and simply you could use Python’s own http.server (http.server — HTTP servers — Python 3.13.0 documentation) in the knowledge that it’s literally just a server than can “speak http” (e.g. knows how to send and receive data using the hypertext transfer protocol) with everything else being literally up to you.
(As long as you accept the fact that you really don’t want to use it in production because it has no security built in whatsoever. Just setting up Flask once and never thinking about it again is generally the better way to go. That way you can stop being annoyed at it once it does what you need)