Button to trigger another .show() on the same page

Hey

I have a program that has 2 pages
one page where I upload files and an “upload” button that triggers a show_plots(files) function, its output is plots.show(). When I run it locally, i just get another server in a new tab which is ok for me. Yet, when I deploy the app to heroku it does not work…
Can I somehow tell my program to trigger the .show() on the current server instead?

Thanks in advance for the help :slight_smile:

Maybe you can use

tabs = pn.Tabs()
def show_trigger():
    tabs.append(plot)

Hi @alonsht

My understanding is that on Heroku you would not easily be able to use .show(). The reason is that it starts a new server that runs on another port. Heroku does not expect and forward that port. On your local laptop you can access all ports without problems.

The simplest solution would something like @ahuang11 is hinting at. Try showing the plot in the same app. For example by adding a new Tab.

You can also take a look at the example Download upload csv — Panel 0.11.3 documentation (holoviz.org) for inspiration. This showcases how to upload a csv file and show the data in a Plotly plot.