What is throwing me for a loop is… whenever I send a new message I’m getting this error: AttributeError: 'Chat' object has no attribute 'call_js' at Chat, line 22
I’m guessing your Chat Form is a Blank Panel form… only HTML Forms have a self.call_js method. I got thrown by this one recently.
You can do js.call_js but since you don’t have an HTML Form in your app it will still fail since this doesn’t mean anything (this refers to the HTML Form that you are calling from)
Yes, as @stucork says, BlankPanel Forms do not have a built-in call_js method. I’m going to update the docs to make this a little clearer! There are two options, as @stucork has said: use a Custom HTML Form and self.call_js(), or use the global anvil.js.call_js() to call a function in Native Libraries.
I’ve tweaked your example slightly to turn your ‘Chat’ Form into a CustomHTML Form - that now contains the scrollCard function that will be called when a new message is added to the chat: