Shapekey driver update issue

Not sure if this is a python or a driver question. Probably both.

I have a script with a function setting shape key values, and another function duplicating the object, creating a shapekey from mix, and removing all the shapekeys.

def set_shape_key_values(shape_key_values):
    # Sets shape key values based on a dict. Keys are shapekeys, values are values.
    obj = bpy.context.active_object
    
    # Set all shape keys to 0
    for shape_key in obj.data.shape_keys.key_blocks:
        shape_key.value = 0

    # Set the shape keys with matching names to the values in the dictionary
    for shape_key_name, shape_key_value in shape_key_values.items():
        obj.data.shape_keys.key_blocks[shape_key_name].value = shape_key_value

def apply_some_shapekeys(shapekeys, obj):
    obj = bpy.data.objects[obj]

    set_shape_key_values(shapekeys)
    # Create a new shape key from mix on the new object
    # Create a duplicate of the object with a new name
    new_obj = obj.copy()
    new_obj.data = obj.data.copy()
    new_obj.name = 'new_name'
    new_obj.shape_key_add(name="Mix")

    # Apply all the shape keys to the new object
    for shape_key in new_obj.data.shape_keys.key_blocks:
        new_obj.shape_key_remove(shape_key)

    bpy.context.collection.objects.link(new_obj)

Normally this works fine for applying shapekeys (I know this is not the best solution but so far I didn’t find a better one)

My issue - the shape keys that are set are driving other shapekeys. I expected the driven shape keys to be taken into consideration when creating the shape key from mix, however that does not seem to be the case when I do it with python:
driverissue_02

Running the script until the point where it is supposed to create the mix, and creating it manually, does however give the desired result of creating a mix with taking all driver values into account:
driverissue_01

I expect it to be some sort of driver refresh thing perhaps? Is there a way around this?

I’m currently using a function to export to obj, and import the object back, which I very much would like to avoid.

edit: turn out this is what I was looking for -

bpy.context.evaluated_depsgraph_get()