I assume that this operation is not clear to me.
When I add a new modifier, I would like a modifier (which I have already identified) to be moved to the bottom of the list of existing modifiers.
I am trying to move it, but I see that it does not work if the object in question, where the "Smooth" modifier is present, is not moved.
On the contrary, if the object in question is active, it is moved perfectly to the bottom.

I am using:

    #ob = my object, not necessarily it must be selected, it is found by a function
    #smooth = #my modifier (found through a function)
    for m in ob.modifiers:
        bpy.ops.object.modifier_move_down(modifier = smooth.name)

This only works if the active object is `ob`.

Do I have to overwrite the context?

I saw a similar answer to [this][1] question, but I'm not sure it's my case, I would like to understand better. Although it appears that I am not getting any errors in my case.


Note:

It seems that I have solved my problem with this solution:

    for m in ob.modifiers:
        c = {}
        c["object"] = c["active_object"] = ob
        bpy.ops.object.modifier_move_down(c ,modifier = smooth.name)

I understand that the "for" loop method is not the best, as it may already be almost at the bottom, so it would "Move down" many more times than you need


  [1]: https://blender.stackexchange.com/questions/90342/context-is-incorrect-python-error-while-script-moves-modifier-up-in-modifier