Not sure if this is quite what you are looking for :
and here’s a very simple project showing it working. Note I had to disable the python 3 checking as the client only uses python 2-ish, but it seems to work :
https://anvil.works/build#clone:3PLVD3QU7F6Q3VX7=GE7RGUD665IRBZY6KLK75DU6
edit
This one looks interesting as well : https://github.com/etissieres/PyEventEmitter
edit 2
updated 18/07/19 @ 09:28 to show attaching to an arbitrary class.
@simon.m.shapiro - was that any use to you? If not can you explain your use case, I might be able to help more.