Clientside callback javascript pass input parameters Class constructor cannot be invoked without "new"

Hi, this is a follow up on another thread I created. This should be a more concise post and better topic description.
Any help to continue my path to make this work is highly appreciated :slight_smile:

The code I have in html that works look like this:

<!DOCTYPE html>
<html data-color-mode="light" xmlns="">
    <meta charset="UTF-8"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Report - ADR</title>
    <script src="./ansys/nexus/utils/js-unzip.js"></script>
    <script src="./ansys/nexus/utils/js-inflate.js"></script>
    <script src="./ansys/nexus/ANSYSViewer_min.js"></script> 
    <script src="./ansys/nexus/viewer-loader.js"></script>
<div style='width:960px;height:720px;'>
<ansys-nexus-viewer src_ext="AVZ" proxy_img="data:application/octet-stream;base64,iVBORw0KGgoAAAANSUhEU...... ></ansys-nexus-viewer>

I have figured out that I should make a clientside callback. So a simple dash app store the input string proxy_img in a and is then passed into the javascript. The dash app should then look like this to do the same as the html code

from dash import html, Output, Input, Dash, no_update, dcc, State, ClientsideFunction, clientside_callback
def read_first_line(filename):  
    with open(filename, 'r') as f:  
        first_line = f.readline()  
    return first_line  
filename = 'pictest.txt'
first_line = read_first_line(filename)

app = Dash(__name__)
app.layout = html.Div(
        html.Button('testing', 'testing'),
        dcc.Store(id='memory', data = first_line)
    function (n, data) {
        if (n) {
            return {'type': 'Div', 'namespace': 'dash_html_components', 'props': {'children': AnsysNexusViewer(src_ext="AVZ",proxy_img=data)}}
        return window.dash_clientside.no_update
    Output("test", "children"), Input("testing", "n_clicks"), State("memory", "data")
if __name__ == "__main__":

But running this app I get the following error:

(This error originated from the built-in JavaScript code that runs Dash apps. Click to see the full stack trace or open your browser's console.)
TypeError: Class constructor AnsysNexusViewer cannot be invoked without 'new'

    at ns.51fa3c57d14716c44708b5eefdf84690 (

    at _callee2$ (

    at tryCatch (

    at Generator.<anonymous> (

    at (

    at asyncGeneratorStep (

    at _next (


    at new Promise (<anonymous>)


I found a different route. So now it works. I wass lucky to get a java script function that did what I needed. So not really solved. But it works now.