Call back function not triggered

Hello, Iโ€™m trying to make this code work:

import plotly.graph_objects as go
from cProfile import label
import sys
import os
from turtle import title
from warnings import catch_warnings
from pathlib import Path
from datetime import date
import tkinter as tk
import numpy as np
from PySide2 import QtCore
import matplotlib.pyplot as plt
from tkinter import filedialog
from PyQt5 import uic, QtWidgets
from PyQt5.QtWidgets import QMainWindow,QApplication, QStyledItemDelegate,QTableWidget
from PyQt5.QtWebEngineWidgets import QWebEngineView
from plotly.graph_objects import Figure, Scatter, FigureWidget
import plotly
import ipywidgets as widgets
import csv
import threading
import numpy as np
from IPython.display import display

np.random.seed(1)
class MainWindow(QMainWindow):

    def __init__(self):

        super(MainWindow, self).__init__()

        x = np.random.rand(100)
        y = np.random.rand(100)

        f = go.FigureWidget([go.Scatter(x=x, y=y, mode='markers')])

        scatter = f.data[0]
        colors = ['#a3a7e4'] * 100
        scatter.marker.color = colors
        scatter.marker.size = [10] * 100
        f.layout.hovermode = 'closest'


# create our callback function
        out = widgets.Output(layout={'border': '1px solid black'})
        out.append_stdout('Output appended with append_stdout\n')
        @out.capture()
        def update_point(trace, points, selector):
            print("test")
        scatter.on_click(update_point)
        widgets.HBox([f,out])

        # we create html code of the figure
        html = '<html><body>'
        html += plotly.offline.plot(f, output_type='div', include_plotlyjs='cdn')
        html += '</body></html>'

        # we create an instance of QWebEngineView and set the html code
        plot_widget = QWebEngineView()
        plot_widget.setHtml(html)
        

        # set the QWebEngineView instance as main widget
        self.setCentralWidget(plot_widget)
        self.callback(scatter,f)
        
        
       
if __name__=='__main__':
    app =  QtWidgets.QApplication(sys.argv)
    window = MainWindow()
    window.show()
    app.exec_()

Iโ€™m using PyQt5 for the UI, but iโ€™m not able to print the message inside the call-back function when clicking a point in the graph, itโ€™s never triggered. I donโ€™t know what to do. I canโ€™t change to dash because in the real program Iโ€™m working at is local and offline, also using PyQt5 for the interface. Can someone please help?