For my addon I need a function that simulates just a single ESC button event from the keyboard, using Python. I've tried many things and this seems to be the only way left to abort
operator without killing the whole Blender.
I've found this Ctypes method. This is builtin module unlike win32api or Pynput, so it can be imported without install right from inside the Blender. It seems to be exactly what I need. But importing the whole module and writing all those classes is obviously way too much for just a single ESC keyboard command, and unfortunately my current programming skills don't allow me to get through the whole module to find what I need. Please, can anyone help me with this?