Thank you for your response! :)
I understand what you do with that element, is like a flag that tell you when something happened, to then check the console that is a great idea!
The thing is I need to show also show the error on screen because we are building like an editor for an online Python course, and we want the student to see everything on the screen and save the step of opening the browser console.
I also tried with the Interpreter module because it shows all mistakes and outputs right away by doing:
<body onload=brython()>
<textarea id="code">print("hello")</textarea>
<script type="text/python3">
from interpreter import Interpreter
Interpreter("code")
</script>
</body>
but the problem with this one is that the print("hello") gets overwritten by the interpeter so the code never display on screen.
If you know any way of actually attaching like default code to run inside the interpreter that would be very helpful!
Thanks for the help! :D