Forced material refreshing before render I am no familiar with scripting, but I can't see another way to solve my problem with material updating in Animation, so help me please.

Render engine is Blender Render and this button is a part of built-in Node Wrangler add-on.
Basic scenarion for the script is to select Output node in a list of materials (or at least one material) and click this Reset button on every frame change.
I didn't figure out how to automatically click that button, so tried to cut/create link between Output and previous node.

This code is kind of refreshes material named "Material" before rendering (at least my case).

import bpy
def remove_link(scene):
   mat = bpy.data.materials['Material'].node_tree
   node1 = mat.nodes['Mix']
   node2 = mat.nodes['Output']
   links = mat.links
   link = node1.outputs[0].links[0]
   links.remove(link)
   link = links.new(node1.outputs[0], node2.inputs[0])

bpy.app.handlers.frame_change_pre.append(remove_link)