Can Streamlit Image Coordinates (dynamic update) be used with a form?

Hello,
I am trying to get the dynamic update feature of streamlit-image-coordinates to work inside a form (user can select a location which will be logged upon submission). The code I am trying to use is as follows:

def selectLocation():
if “point” not in st.session_state:
st.session_state[“point”] = [None, None]

def get_ellipse_coords(point: tuple[int, int]) -> tuple[int, int, int, int]:
    center = point
    radius = 10
    return (
         center[0] - radius,
        center[1] - radius,
        center[0] + radius,
        center[1] + radius,
    )

img = Image.open("plotplan.png")
draw = ImageDraw.Draw(img)

# Draw an ellipse at each coordinate in points
point = st.session_state["point"]
if point != [None, None]:
    coords = get_ellipse_coords(point)
    draw.ellipse(coords, fill="red")

value = streamlit_image_coordinates(img, key="pil")

if value is not None:
    point = value["x"], value["y"]

    if point != st.session_state["point"]:
        st.session_state["point"] = point
        st.rerun()

This works if I run it in a standalone page, but it stops working if I run the function inside a form. Please let me know if there are any fixes/workarounds or if this isn’t possible with the current version.

I have also experimented with @st.experimental_fragment and removing the st.rerun() function. Again, this works in my non-form testbed, but it does not work inside the form.