Control video texture "start frame" with VSE clip "start frame"

I’d like to make a (hopefully) simple script to sync the start frame of a video (or image sequence) texture map with the start frame of a VSE clip of the same video file/image sequence. This would be used to be able to edit the timing of video textures in the VSE. It doesn’t have to be in real-time, although that would be nice to develop later, right now I just want to easily be able to give the command “texture start frame = VSE start frame” so I can make the adjustments to the VSE clips and then sync the textures to those adjustments. Another thing to develop later would be getting Blender to recognize when the video in the VSE is the same video in the texture, but again that can wait; I know I’ll have to tell it which video texture to sync with which VSE clip every time; but that’s okay. I’m just trying to hammer out the bare basics.


I tried just a simple “Copy Data Path” of both the start frame of the image texture and the VSE clip in the Python console:

nodes["Image Texture"].image_user.frame_start = sequence_editor.sequences_all["video.001"].frame_start

But that failed with a “NameError: name ‘nodes’ is not defined” message.

And apparently there’s something very basic that I don’t understand about the “Copy Data Path” command because the pasted results from those left out a lot that the tooltip showed hovering over the same fields. Copy data path pasted:

nodes["Image Texture"].image_user.frame_start
sequence_editor.sequences_all["video.001"].frame_start

But the tooltip showed:

bpy.data.node_groups["Shader Nodetree"].nodes["Image Texture"].image_user.frame_start
bpy.data.scenes["Scene"].sequence_editor.sequences_all["video.001"].frame_start

But manually typing that out also failed:

bpy.data.node_groups["Shader Nodetree"].nodes["Image Texture"].image_user.frame_start = bpy.data.scenes["Scene"].sequence_editor.sequences_all["video.001"].frame_start

That failed with a “KeyError: ‘bpy_prop_collection[key]: key “Shader Nodetree” not found’” error.

Is what I’m trying to do even possible? I’d be open to using drivers too, but I saw no way of applying a driver to that node attribute. Any help would be appreciated. Thank you.

I found a StackExchange question talking about a very similar situation. There is a script example there that I’m experimenting with. If anyone else has this issue here is a link: https://blender.stackexchange.com/questions/48762/change-or-update-audio-start-with-video-texture-start-frame