I am new to plotly/Dash. When I run the code from the website tutorial Updates On Page Load,
import datetime import dash import dash_html_components as html def serve_layout(): return html.H1('The time is: ' + str(datetime.datetime.now())) app = dash.Dash() app.layout = serve_layout if __name__ == '__main__': app.run_server()
I get the following error
for component in self.layout.traverse():
AttributeError: ‘function’ object has no attribute ‘traverse’
However if I do app.layout = serve_layout() then it works.
I searched the forum and found some discussion about redefining the app twice, but nothing regarding ‘function’ object. Any help is much appreciated.
Thanks a lot