# Dunders in Blender II – Building an Expressive Syntax

**URL:** <https://blenderartists.org/t/dunders-in-blender-ii-building-an-expressive-syntax/1453059>\
**Category:** Python Support\
**Created:** [March 3, 2023, 8:24pm UTC](https://blenderartists.org/t/dunders-in-blender-ii-building-an-expressive-syntax/1453059 "2023-03-03T20:24:57Z")\
**Posts on this page:** 1\
**Showing post:** 5

<div class="post-metadata">

**Author:** ![Gorgious](https://blenderartists.org/user_avatar/blenderartists.org/gorgious/32/914296_2.png) [@Gorgious](https://blenderartists.org/u/Gorgious)\
**Post date:** [March 11, 2023, 10:46pm UTC](https://blenderartists.org/t/dunders-in-blender-ii-building-an-expressive-syntax/1453059/5 "2023-03-11T22:46:04Z")

</div>

The snippets of code on the github page remind me of [https://github.com/curtisjamesholt/EasyBPY/blob/master/easybpy.py](https://github.com/curtisjamesholt/EasyBPY/blob/master/easybpy.py)

It seems to have gained a bit of traction, so I’m sure there are people wanting to get an easier, more abstract API.

Regarding this snippet maybe I can offer a bit of optimization

```auto
    material_name = re.findall(r'(?<=materials\[\')\w+', repr(self.node))[0]
    material = bpy.data.materials[material_name]
    node_tree = material.node_tree

```

you can get the node tree from a node simply by using `node.id_data` see [https://docs.blender.org/api/current/bpy.types.bpy\_struct.html#bpy.types.bpy\_struct.id\_data](https://docs.blender.org/api/current/bpy.types.bpy_struct.html#bpy.types.bpy_struct.id_data)

---

_[View the full topic](https://blenderartists.org/t/dunders-in-blender-ii-building-an-expressive-syntax/1453059)._
