Slow loading with "from plotly import figure_factory as ff"

I would like to create a Gantt Chart with Plotly, but when I try to import the library “from plotly import figure_factory as ff”, from the server, it increases too much the loading time of the whole application. The load times are multiplied x2, at least!

Do you know any alternative that does not affect performance?

Thanks in advance.

I have found a solution: add the import of the library inside the function. This way, I only import import when I load the function. It has improved the performance a lot.

@anvil.server.callable
def get_gannt_period():
  from plotly import figure_factory as ff
#more code...

3 Likes

Thanks for posting your solution @Will1 :slightly_smiling_face:

1 Like