diff --git a/plotly/graph_objs/_figure.py b/plotly/graph_objs/_figure.py index 99529b66f1a..4f7455a1825 100644 --- a/plotly/graph_objs/_figure.py +++ b/plotly/graph_objs/_figure.py @@ -12779,7 +12779,11 @@ def add_sankey( ------- Figure """ - from plotly.graph_objs import Sankey + if not hasattr(self, "_Sankey_cls"): + from plotly.graph_objs import Sankey + + self._Sankey_cls = Sankey + Sankey = self._Sankey_cls new_trace = Sankey( arrangement=arrangement,