CustomJSHover on Jupyter Notebooks

Hello, I have a feeling that customJSHover is not being called on my jupyter notebook leading to ‘???’ or ‘Nan’ when hovering. As a quick example, I took the simple mercator example that uses customJSHover to give latitude and longitude

from import curdoc
from bokeh.models import HoverTool, CustomJSHover
from bokeh.plotting import figure
from bokeh.tile_providers import CARTODBPOSITRON, get_provider

# range bounds supplied in web mercator coordinates
p = figure(x_range=(-2000000, 6000000), y_range=(-1000000, 7000000),
        x_axis_type="mercator", y_axis_type="mercator")
p.add_tile(get_provider(CARTODBPOSITRON))[0, 2000000, 4000000], y=[4000000, 2000000, 0], size=30)

code = """
    var projections = require("core/util/projections");
    var x = special_vars.x
    var y = special_vars.y
    var coords = projections.wgs84_mercator.inverse([x, y])
    return coords[%d].toFixed(2)

        ( 'lon',   '@x{custom}' ),
        ( 'lat',   '@y{custom}' ),

        'x' : CustomJSHover(code=code % 0),
        'y' : CustomJSHover(code=code % 1),


This is the code I ran but when I hover its shows the x and y values of the circles, so the values are 2000000 or 4000000. I believe it is not calling customJSHover and instead just grabbing the x and y values. If I change the names of the formatters to not be x or y then hovering just shows ‘???’. I don’t know what I am doing wrong.

If it helps my jupyter version is 4.4.0

formatters require full field name, including the @ sign. Try using @x and @y.