Use HTML elements as components with custom HTML?

You might have a look at this post in the forum: Custom HTML - Button event binding

Specifically you want to look at the Javascript binding. It shows one way to call a Python function from an HTML button.