Override dupligroup's object's material

I’ve spent several days experimenting with methods based around this video:
[video]https://youtu.be/bOLMkw_wDGE[/video]

The examples in the video will work for me (finally after days of experimenting; I’m semi-new to python and very new to Blender scripting), but I can’ figure out how to apply the methods shown in the video to override a material on a dupligroup; in other words, apply a material in the current file to the objects in the dupligroup. For example:

-source.blend has a group calling ‘thing’ with an object called ‘box’ in it with material ‘red’.
-dest.blend has a material called ‘blue’ and a dupligroup of ‘thing’ from source.blend.

Within dest.blend in the python console:

bpy.data.objects['box'].material_slots['red'].material = bpy.data.materials['blue']

Does NOT give me an error message (and it does autocomplete to that point) but it just doesn’t do anything.

This is the closest I’ve come because all my other attempts have given me an error message. What am I doing wrong here? Any ideas would be very much appreciated. Thank you.

Edit: By the way I do know about the Edit Linked Libraries addon, but that doesn’t work for what I want to use this method for. As far as I can tell the addon just lets you more easily edit the linked object’s source file thereby editing the linked object, whereas with this method I’d like to be able to have multiple instances of the linked object all linked from one file, but with different materials.

So does anyone at least know if this is possible? If it’s not likely to be possible in terms of how this sort of Python editing of linked objects normally works, okay, I’ll just figure out something else. Any idea? Thank you.

While not being able to assign material as a whole i succeeded to assign other material’s properties e.g. diffuse_color. Did not experiment further.

Thank you for the reply Eppo. Yeah, changing material properties was demonstrated in the video, but it seems like if that’s possible it aught to be possible to override the entire material.