# Panel Code Issue

**URL:** <https://discourse.holoviz.org/t/panel-code-issue/8409>\
**Category:** Panel\
**Tags:** bokeh, panel, holoviews\
**Created:** [November 20, 2024, 10:59pm UTC](https://discourse.holoviz.org/t/panel-code-issue/8409 "2024-11-20T22:59:30Z")\
**Posts on this page:** 2\
**Page:** 1

<div class="post-metadata">

**Author:** ![Simon\_K](https://discourse.holoviz.org/letter_avatar_proxy/v4/letter/s/f19dbf/32.png) [@Simon\_K](https://discourse.holoviz.org/u/Simon_K)\
**Post date:** [November 20, 2024, 10:59pm UTC](https://discourse.holoviz.org/t/panel-code-issue/8409/1 "2024-11-20T22:59:30Z")

</div>

Hello Community!

I was trying several ways to serve multiple applications and I found the following as one of the ways:

```auto
import panel as pn

pn.extension(sizing_mode="stretch_width")

pages = {
    "Page 1": pn.Column("# Page 1", "...bla bla bla"),
    "Page 2": pn.Column("# Page 2", "...more bla"),
}

def show(page):
    return pages[page]

starting_page = pn.state.session_args.get("page", [b"Page 1"])[0].decode()
page = pn.widgets.RadioButtonGroup(
    value=starting_page,
    options=list(pages.keys()),
    name="Page",
    sizing_mode="fixed",
    button_type="success",
)
ishow = pn.bind(show, page=page)
pn.state.location.sync(page, {"value": "page"})

ACCENT_COLOR = "#0072B5"
DEFAULT_PARAMS = {
    "site": "Panel Multi Page App",
    "accent_base_color": ACCENT_COLOR,
    "header_background": ACCENT_COLOR,
}
pn.template.FastListTemplate(
    title="As Single Page App",
    sidebar=[page],
    main=[ishow],
    **DEFAULT_PARAMS,
).servable()

```

However, when I run this code on my device, this error pops up:

```auto
    pn.state.location.sync(page, {"value": "page"})

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

```

Can anyone help how to resolve this?

Thanks!

---

<div class="post-metadata">

**Author:** ![ahuang11](https://discourse.holoviz.org/user_avatar/discourse.holoviz.org/ahuang11/32/4947_2.png) [@ahuang11](https://discourse.holoviz.org/u/ahuang11)\
**Post date:** [November 22, 2024, 9:06pm UTC](https://discourse.holoviz.org/t/panel-code-issue/8409/2 "2024-11-22T21:06:27Z")

</div>

From [Access and Manipulate the URL — Panel v1.5.4](https://panel.holoviz.org/how_to/state/url.html)

> In a notebook environment `pn.state.location` is not initialized until the first plot has been displayed

Are you using a notebook?
