How to update a pn.pane.HTML() widget on the click of a button?

How to update a pn.pane.HTML() widget on the click of a button?

I get new input for the HTML page using button.on_click(getSomeHTML()), but my pn.pane.HTML(toBeShown) only shows the initial value of toBeShown.

How do I trigger updates?


def update_callback(event):
    html.object = "New string"

html = pn.pane.HTML("Initially")
button.on_click(update_callback)

This solution is beautiful! I am so happy I asked this question.

OK, so this exact method is mentioned in the documentation for a LaTeX pane, but not for a HTML pane. I suggest adding this method also to the documentation of the HTML pane.