Why is it that when I right click on a data field and click "Copy Data Path" and paste, it will paste something like this (example: the "Start Frame" of a VSE strip):


But the tooltip that can be seen when hovering over the same field shows a longer data path:

bpy.data.scenes["Scene"].sequence_editor.sequences_all["roomWalls01.001"].frame_start a screenshot of the tooltip saying "bpy.data.scenes["Scene"].sequence_editor.sequences_all["roomWalls01.001"].frame_start"

"Copy Data Path" leaves off the first part: bpy.data.scenes["Scene"].

Why does it leave that off? Isn't that part usually necessary when making scripts?

I'm very new to Blender Python scripting but I've tried some scripts and I often end up typing the first part out by hand, which seems like an unnecessary hassle.

I theorize that this has something to do with the fact that many Blender Python scripts start out defining variables like these:

context = bpy.context

scene = context.scene

sequences = scene.sequence_editor.sequences_all

But I don't know how I'm supposed to know what kind of variable like that I will have to define first.

I would just like to know why this is. It seems like it probably makes sense, and I'm just using a bad Python workflow or approach. Any explanations? Thank you.


1 Answer 1


Copy Data Path

From https://www.blender.org/api/blender_python_api_2_77_release/bpy.types.bpy_struct.html?highlight=id_data#bpy.types.bpy_struct.id_data

Note that when keying data paths which contain nested properties this must be done from the ID subclass, in this case the Armature rather than the bone.

Or in the case you pointed out from the scene rather than the strip.

To explain using the console, I have a vid seq called blackfoot, it tells me its id_data is the scene. (The bit you mentioned as "left out")

>>> C.scene.sequence_editor.sequences_all['blackfoot'].id_data

Ok now look at frame_start property

>>> C.scene.sequence_editor.sequences_all['blackfoot'].frame_start

>>> C.scene.sequence_editor.sequences_all['blackfoot'].path_resolve('frame_start')

>>> C.scene.sequence_editor.sequences_all['blackfoot'].path_from_id('frame_start')

The last one looks familiar, it's what you get when you copy data_path, ie the path from the ID data.


context = bpy.context
scene = context.scene
sequences = scene.sequence_editor.sequences_all

is just IMO good coding practice making the code much more readable

sequences['blackfoot'].frame_start = 1


bpy.data.scenes['Scene'].sequence_editor.sequences_all['blackfoot'].frame_start = 1

NB. I also use context = bpy.context in test files, to make pasting them into operator or panel code later simple as context is passed by def to just about all methods.

  • $\begingroup$ Oh Jeeze. A lot of this goes over my head. I probably just had the wrong idea about the "Copy Data Path" command. It seemed like the command could be a shortcut to data in Blender for use in simple Python scripts, like for being able to do quick and simple data = data and similar scripts. But based on your answer it looks like even to use the result of "Copy Data Path" you have to know of lot of commands to query the information necessary to use the result. I guess there are no shortcuts! I will keep looking for newbie-friendly Blender python documentation. Thank you for the answer! $\endgroup$ Mar 20, 2016 at 16:55

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .