I would like to, using only Python, relocate a linked library to another file. This is the equivalent of showing the "Blender file" content in the Outliner, right-clicking on the linked library and choosing "Relocate":
Going step by step in the native Blender code using a debugger, I was able to figure out the properties to give to the operator (which is wm.lib_relocate):
bpy.ops.wm.lib_relocate( library="cube-v02.blend", directory="C:\\Users\\someone\\Desktop\\", filename="cube-v01.blend" )
- library is the name of the library to relocate which seems to be the file name (without the directory part).
- directory is the directory where the new library (blend file) is located.
- filename is the file name of the blend file.