Js_on_change for PreText not working in Bokeh Server

Can anyone please help as to why this code is not working. I am new to bokeh and was trying out the customJS change on Pretext Object.
import pandas as pd
import numpy as np
from bokeh.models import ColumnDataSource, CustomJS, PreText
from bokeh.models.widgets import DataTable, NumberFormatter, TableColumn, Button
from bokeh.io import curdoc
from bokeh.plotting import show
from bokeh.layouts import column

import base64
import io

bt0 = Button(label='Click me')
not_yet_called = True

encodedData = None

data = None
df = None

def prepare_df():
    global not_yet_called
    bool (not_yet_called)
    if not_yet_called:
        not_yet_called = False
        pretext.text="1"
        
    else:
        not_yet_called = True
        pretext.text="2"

pretext=PreText(text='')
print(pretext.text)
pretext.js_on_change('text', CustomJS(code="""alert('Hello')"""))
pretext.text='abcd'
print(pretext.text)

bt0.on_click(prepare_df)
curdoc().add_root(bt0)

Hi @Saurabh_Lall please edit your post to fix the code formatting so that the code is intelligible (either with the </> icon on the editing toolbar, or triple backtick ``` fences around the code blocks)

Additionally, FYI I have moved the post. It belongs in the Community Support category. The Development category is for topics relating to development of the Bokeh library itself.