diff --git a/plotly/graph_objs/_figure.py b/plotly/graph_objs/_figure.py index 99529b66f1a..9f872d45f14 100644 --- a/plotly/graph_objs/_figure.py +++ b/plotly/graph_objs/_figure.py @@ -15137,7 +15137,11 @@ def add_scattergl( ------- Figure """ - from plotly.graph_objs import Scattergl + if not hasattr(self.__class__, "_Scattergl_cls"): + from plotly.graph_objs import Scattergl + + self.__class__._Scattergl_cls = Scattergl + Scattergl = self.__class__._Scattergl_cls new_trace = Scattergl( connectgaps=connectgaps,