can’t figure out why my code is not working. I try to create an instance variable in the constructor of my class. This works when the class doesn’t inherit from another class as well as when it inherits from a class I defined within the same scope. But when I try to inherit FigureWidget, I get an AttributeError. The code looks as follows:
import plotly.graph_objects as go class HeatmapLines(go.FigureWidget): def __init__(self): self.y_heatmap_lines=4 a=HeatmapLines()
And the error:
AttributeError Traceback (most recent call last) <ipython-input-104-67db37616276> in <module> ----> 1 a=HeatmapLines() <ipython-input-103-49446a09e448> in __init__(self) 1 class HeatmapLines(go.FigureWidget): 2 def __init__(self): ----> 3 self.y_heatmap_lines=4 4 5 /usr/local/lib/python3.7/site-packages/plotly/basedatatypes.py in __setattr__(self, prop, value) 722 else: 723 # Raise error on unknown public properties --> 724 raise AttributeError(prop) 725 726 def __getitem__(self, prop): AttributeError: y_heatmap_lines
I posted this a few days ago in stackoverflow, but nobody seems to be able to help me there so I thought I post it here in case it is something specific to plotly.