Template doesn't update when using callback

This is in fact expected, templates as the name suggests, use templating to generate a HTML file that will be served on initial render. To achieve what you want you will have to add a Row/Column to the template.main object which you can then subsequently populate.

from functools import partial

def view():
    template = pn.template.BootstrapTemplate()
    container = pn.Column(sizing_mode='stretch_both')
    template.main.append(container)
    container.append(pn.pane.Markdown("**Loading ...**"))

    pn.state.onload(partial(load_dashboard, container))

    return template

def load_dashboard(container):
    print("Loading")
    container[:] = [pn.widgets.StaticText(name="Status", value="loaded")]
    print("Done")
1 Like