Hydralit library in streamlit

Ask the community or our support engineers for answers to questions.

I am trying to run the hydralit library in streamlit in order to create a multi-page application. I am trying to run the following code:

import hydralit as hy

app = hy.HydraApp(title='Simple Multi-Page App')

@app.addapp(is_home=True)
def my_home():
    hy.info('Hello from Home!')

@app.addapp()
def app2():
    hy.info('Hello from app 2')

@app.addapp(title='The Best', icon="🥰")
def app3():
    hy.info('Hello from app 3, A.K.A, The Best 🥰')

app.run()

I know that streamlit applications can be run with the command streamlit run app.py.

How can I run hydarlit from streamlit? I am getting an error as follows:

No module named ‘streamlit.script_run_context’

Edit: I found the solution to the above error.
Hydralit works with an old version of streamlit that uses the command:

from streamlit.script_run_context import get_script_run_ctx

This command was running in the session_state.py file of the Hydralit library. All that I had to do was
change the command to:

from streamlit.scriptrunner.script_run_context import get_script_run_ctx

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.