I would like to subclass the dash_core_components Graph class to add the ability to automatically download the data shown on the graph. I have this functionality working but it appears to break dash debug mode. I have narrowed this down to any class that inherits from dcc.Graph fails in debug with:
raise ImportError(msg.format(fullname, type(ex), ex)) from ex
ImportError: Error while finding loader for '__main__' (<class 'ValueError'>: __main__.__spec__ is None)
The minimal example below works fine when debug=False but fails as written
import dash
import dash_core_components as dcc
import dash_html_components as html
app = dash.Dash('MyDashApp')
app.layout = html.Div('test')
class SubclassGraph(dcc.Graph):
pass
app.run_server(debug=True)
Versions:
- dash 1.11.0
- dash_core_components 1.9.0
- dash_html_components 1.0.3
Please advise how to properly subclass dash_core_components.
Thanks