I am trying to created a simple project that reproduced my problem.
.
βββ ./README.md
βββ ./panel_test
β βββ ./panel_test/init.py
β βββ ./panel_test/pycache
β β βββ ./panel_test/pycache/init.cpython-37.pyc
β βββ ./panel_test/model
β β βββ ./panel_test/model/init.py
β β βββ ./panel_test/model/pycache
β β β βββ ./panel_test/model/pycache/init.cpython-37.pyc
β β β βββ ./panel_test/model/pycache/selector.cpython-37.pyc
β β βββ ./panel_test/model/selector.py
β βββ ./panel_test/test.ipynb
βββ ./panel_test.egg-info
β βββ ./panel_test.egg-info/PKG-INFO
β βββ ./panel_test.egg-info/SOURCES.txt
β βββ ./panel_test.egg-info/dependency_links.txt
β βββ ./panel_test.egg-info/top_level.txt
βββ ./requirements.txt
βββ ./setup.py
Inside of setup.py is below.
from setuptools import setup, find_packages
setup(
name='panel_test',
version='0.0.0',
license='proprietary',
description='For test panel',
author='Arifin',
# install_requires=[
# "requests",
# ],
packages=[
'panel_test',
'panel_test.model',
]
)
The inside of ./panel_test/model/selector.py is below.
import panel as pn
import param
STRING_OPTIONS=[βAβ, βBβ, βCβ]
class StringSelections(param.Parameterized):
strings = pn.widgets.RadioBoxGroup()
def __init__(self, **params):
super().__init__(**params)
self.strings.options = STRING_OPTIONS
self.strings.value = STRING_OPTIONS[0]
Then, I used βpip install -e /path/to/the/package/β to install the package to my environment.
./panel_test/test.ipynb
import panel as pn
import param
pn.extension()
from panel_test.model import StringSelections
StringSelections().strings.servable();
then, I serve it using panel as below
panel serve --address=β0.0.0.0β --port=8000 --allow-websocket-origin=IP_ADDRESS:PORT /path/to/test.ipynb --autoreload
I accessed the apps through the Chrome 90.0.4430.212. I used 2 tabs and when I change the selections (for example βBβ), both tabs will give βBβ selected.
If I copy and paste inside of selector.py into one of the cell in test.ipynb, commented out the import part(# from panel_test.model import StringSelections), reload the server, the selectors in different tabs will not mirroring each other.
Any idea about it?
Thanks.