Auto-Populating data_editor data based on user edit

I’m relatively new to streamlit, but I’ve found it super useful for basic things. I have an app that works really well, but I’m trying to improve it with a bit of interactivity. I have an app that has an editable dataframe, runs some QA checks, and writes values to a database. What I want to do is if they enter the key and it already exists in the database for it to auto-fill the rest of the columns. I’m able to pull all the info, but change are not being shown on the screen. Example code with dummy change:

import pandas as pd
import streamlit as st

def df_changed():
  print(st.session_state["my_df"])
  st.session_state["df"]["val2"] = "testing"
  print(st.session_state["df"])
st.session_state["df"] = pd.DataFrame({"Key":[""],"val1":[""],"val2":[""]})
st.data_editor(st.session_state["df"], num_rows="dynamic",hide_index=False,on_change=df_changed,key="my_df")

What I would expect would be if I type in a value in key, it would auto-populate “testing” into val2 on the screen. When I make that change it prints out the change, prints out a dataframe with “testing” in val2 but without the edited change, but the screen only contains the edited change and is not updated to match the dataframe being printed. I’ve looked at a good number of threads here on this topic and most of the suggestions made it seem like moving the dataframe to the session state as I’ve done here would solve the issue and allow me to auto-populate values as the dataframe is edited by the user.

What am I doing wrong here?

Thanks!