View Single Post
But I can't find a way to get the actual task from a tree element. does work, but other properties (deadline, note) doesn't.
Trees are sort of XML constructs and are not identical to the task/project/context they represent.

What you're looking for is the "value" property of the tree element you're looking at. That will be a reference to the actual object.

No idea how to implement this in Python, but it should send you in the right direction.

Also, tree scripting is substantially faster for just iterating through a list than recursing by context, project, or whatnot.