ETE tree render issue in Dash

Dear All

I am trying to save ETE3 tree as image using Dash application initiated from Jupyter Notebook.
If below line is present before html layout section it works fine, but the same is not working from Callback function.


m_tree is the 3 level tree generated using high frequency words in some dataframe.

Any suggestion what could be missing?

Notebook version: 5.7.4
Python 2.7.15 |Anaconda, Inc.