Print statements in jupyter notebook when using panel

Hi,
This may seem like a simple enough problem.
I am developing a panel dashboard, as a class. It has some functions inside, that read data from files and process them as per some selections based on widgets. Then it finally plots outputs on the graph.

My question is, how can I print something like I would when I am working on jupyter notebook, to the cell output, so that I can debug the intermediate steps? As I was developing the data processing steps, I had to debug some steps, but I could not know by any means what was being stored in my variables or at what step the processing was going haywire. Unless something absolutely breaks, I do not get even an error statement.

PS: I tried printing out stuff using a StaticText widget but my preprocessing involves pandas dataframes and dictionaries and such, which I cannot view properly in the output of a StaticText widget.
What I am trying to do is something like this:

If you use console.log and use the Inspect (or similar function) of your browser, you can see the output.
image
image

1 Like

Hi @ahuang11,
But I cannot print out python variables using console.log

You can still print stuff out your panel function; it’ll appear in the console.

1 Like

Oh, wow. Yeah, seems to work. Thanks a lot.

But still not as good as being able to print stuff to the cell output. It would be great if that could be done somehow.

Using recent versions of pyviz_comms, you should now also see output inline in the notebook, which versions of Panel and pyviz_comms do you currently have?