Image texture offset


I have an image sequence loaded as a texture on a simple plane in blender cycles. I am trying to write a script to change the offset of that sequence over time, but I cannot find the code to change the offset. Copying the offset data path gives:

nodes[“Image Texture”].image_user.frame_offset

but how do I access this? I have tried the following:

my_mat =‘material.001’)
offset_image = my_mat.node_tree.nodes[‘Image Texture’].image_user.frame_offset

but I get an error: ‘bpy_prop_collection’ object is not callable

Can anyone tell me how to get access to the “offset” via script please?

try with brackets instead:

my_mat =[‘material.001’]

Thankyou for your help. Yes my mistake on the round brackets, silly beginners error I’m afraid.

I’ve figured the problem at last though. I needed to use the following command which appears when you hover over the offset button:[“Shader_Nodetree”].nodes[“Image Texture”].image_user.frame_offset = value

However, annoyingly, this wouldn’t work until I created a Shader Nodetree group (“mat1_node”). Without one the code fails to recognise it. (I did try[0]… but this didn’t work either)

This now updates the offset value, although it is very slow to update.

Thanks for your help CoDEmanX. Here is the code that worked:[“mat1_node”].nodes[“Image Texture”].image_user.frame_offset = value

maybe it becomes faster if you set Material.use_nodes = True ?
That might implicitly create a node for the material