AttributeError: 'NoneType' object has no attribute 'lookup'

I have the following code to create a dasboard. It works fine. I mean it produces the plots and figures.

wgt_schoolSelected = pn.widgets.Select(name='Okul Seçiniz:', options=list(classSchool.Name.unique()))
nQuestionsPerExam = pn.widgets.IntSlider(name='Min. Sinav Soru Sayisi', start=0, end=20, step=5, value=5)

# Visualization function that updates based on widget selections
@pn.depends(wgt_schoolSelected, nQuestionsPerExam)
def VisualizeSchoolSube(schoolVal, nQuestion):
    #number of students per each gradelevel for the selected school.
    df_school = classSchool[classSchool.Name == schoolVal]
    df = df_school.groupby('GradeLevel').size().to_frame().rename(columns={0:'Count'})
    bar_studentCountByGrade = df.hvplot.bar(alpha=0.5, width=400, 
                                            line_width=0, color="#e5ae38", label="Öğrenci Sayisi")

    return bar_studentCountByGrade


wgt_gradeLevel= pn.widgets.Select(name='Kaçıncı Sınıf:', options=list(range(5, 13)))

@pn.depends(wgt_schoolSelected, nQuestionsPerExam, wgt_gradeLevel)
def VisualizeGradeLevel(schoolVal, nQuestion, gradeLevel):
    df = examTakes[examTakes.Name == schoolVal]
    df = df[df.GradeLevel == gradeLevel].groupby('ExamType')[['ExamId']].count().rename(columns={'ExamId':'count'})
    
    examTypeCount_plot = df.hvplot.bar(alpha=0.5, width=400, 
                                       height=400, line_width=0, 
                                       color="#A1C7E0", label="Sınav Türü : ").opts(xrotation=45)

    return examTypeCount_plot

pn.Column(
    pn.Row(
        pn.Column(pn.WidgetBox("Seçenekler", wgt_schoolSelected, nQuestionsPerExam), VisualizeSchoolSube)
    ),
    pn.Row(
        pn.Column(pn.WidgetBox("Seçenekler",  wgt_gradeLevel), VisualizeGradeLevel),
    )
)

However, whenever a different item is selected from wgt_schoolSelected, it outputs an error (although the plots are updated properly). I have tried many things since yesterday but still receiving the same error. Interestingly, the same error message block is displayed four times consecutively under each other. I also could not find any related posts about this. I appreciate any help.

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)
File ~\AppData\Roaming\Python\Python39\site-packages\jupyter_bokeh\widgets.py:128, in BokehModel._sync_model(self, _, content, _buffers)
    126 new, old, attr = content["new"], content["old"], content["attr"]
    127 submodel = self._model.select_one({"id": content["id"]})
--> 128 descriptor = submodel.lookup(content['attr'])
    129 try:
    130     descriptor._set(submodel, old, new, hint=hint, setter=self)

AttributeError: 'NoneType' object has no attribute 'lookup'

Can anyone help about this issue? I cannot find a similar issue anywhere. I am struggling a lot.

Can you share a minimal, reproducible example (MRE)?

In general, a complete script can be copied/pasted and immediately run as-is with no modifications. This is much more useful than snippets.

I also had same issue using a single widget for multiple plots.
Are you using vscode to run this?
I had a line to make it render on vscode, which has dependency on jupyter_bokeh:

pn.extension(comms="vscode")

And after removing this it works fine, doesn’t give me this error anymore (now running on jupyter notebook server).

I am getting the same exception, except it appears to specifically occur when one widget cannot “keep up” with another. In my case, I have a 3D xarray.DataArray and used hvPlot to render 2D slices of it, with the slicing controlled by a Player widget. When the Player has a long interval, everything is fine. But increase the playback speed enough, and the error log will be inundated with AttributeErrors identical to the one above. Scrubbing with the Player’s slider has the same effect. Curiously, this only occurs if hvinter (instance of hvplot.xarray.XArrayInteractive) is separated into “content” and “widgets” when composing the layout; in the example below, this is toggled by RAISE_ERRORS.

I encountered this problem in VSCode, but could not reproduce it in Jupyter Lab. I haven’t ruled out the possibility that the error actually occurs in both environments, but is suppressed when running in Jupyter Lab.

import numpy as np
import xarray as xr
import panel as pn
import holoviews as hv
import hvplot.xarray
import dask.array as da
hv.extension('bokeh')
pn.extension(sizing_mode='stretch_width')

arr_shape = (7000, 50, 60)
rng = da.random.default_rng()
vals = rng.standard_normal(size=arr_shape)
mydata = xr.DataArray(vals, dims=('t','y','x'))
player = pn.widgets.Player(name='Player', start=0, end=mydata.sizes['t']-1)
hvinter = (
    mydata.interactive(loc='bottom').sel(t=player)
    .hvplot(width=800, height=400, flip_yaxis=True, cmap='fire', clim=(-2, 2))
)
RAISE_ERRORS = True
raise_indicator = pn.pane.Markdown(f'## RAISE_ERRORS = {RAISE_ERRORS!r}')
if RAISE_ERRORS:
    layout = pn.Column(raise_indicator, hvinter.panel(), *hvinter.widgets(), width=800)
else:
    layout = pn.Column(raise_indicator, hvinter, width=800)
layout