Caching in sub module

the example below needs an import of streamlit in the sub module to become @st known.
works, but is it also allowed, to import the package again?
otherwise, there is no possibility to handle over ‘st’

app.py
------
import streamlit as st
import lib

connString = lib.conn_string(st, 'mf')


lib.py
------
import streamlit as st  # is this correct?

@st.cache_resource
def conn_string(st, src):
    match src:
        case 'mf':
            return 'DRIVER={SQL Server};SERVER=' + st.secrets.database.server + ';DATABASE=' + st.secrets.database.database + ';UID=' + st.secrets.database.username + ';PWD=' + st.secrets.database.password

It is no problem to import Streamlit again. :slight_smile:

thank you.

this should work as well right?