How Can I Receive the Value Returned by a Callback Function?

Hi Guys

My Question is demonstrated with the following codes.

The following code create a form to let user specify factors used to create mysql connection.
Then, she sumbit button the that form has a callback function which will return a mysql connection object.
The question is that, It seems that there is no where to receive the returned mysql connection object of the callback function.
How can I get the returning of a callback function, or, the callback function is just not allowed to have a returning value?

import streamlit as st
import pandas as pd
import mysql.connector

def get_db_connection(host,port,user,database,password):
        #return mysql db connection object
        return mysql.connector.connect(host=host,port=port,user=user, database=database,password=password)
    except Exception as e:
        st.write('Failed to Connect to Database! Try Again!')

sidebar_subtitle1 = st.sidebar.subheader('Connection to Database')
form_db_connection = st.sidebar.form('form_db_connection')
connection_status = form_db_connection.empty()
input_user_name = form_db_connection.text_input(label='Input DB User Name:')
input_db = form_db_connection.text_input(label='Input Database Name:')
input_pass = form_db_connection.text_input(label='Input Password', type='password')
input_db_host = form_db_connection.text_input(label='Input DB Server IP:')
input_db_port = form_db_connection.number_input(label='Input DB Server Port:',min_value=0,max_value=99999,value=3306,step=1)

#I'm try to let button_test_connction to receive the result returned by the callback function, but didn't work!
#Here, button_test_connection is still the submit button of the form which is a boolen value rather then a mysql connection object.
#How can I receive the returning of a callback function (here, is the gained mysql db connection)???
button_test_connection = form_db_connection.form_submit_button('Press to Connect', on_click=get_db_connection,  \
                        kwargs=dict(host=input_db_host,port=input_db_port,                            \
                                    user=input_user_name, database=input_db, password=input_pass))