# Scripted NodeFrame does not attach children until nodeview is updated

This snippet can be run from Text Editor to get an idea of what I mean.

import bpy

nt = bpy.data.materials['Material'].node_tree
nodes = nt.nodes

a.location = 0, 0

b.location = 200, 0

f = nodes.new('NodeFrame')
f.location = -200, 0

a.parent = f
b.parent = f


That produces this initially.

only when i move the mouse inside the nodeview does the Frame update its visual representation.

I would love some suggestions. The code/Operator that we execute in Sverchok has the NodeView context and an edit_tree if that helps.

• Have you tried to update your scene or tag your area – J. Bakker Feb 3 '18 at 10:25
• If the operator is executed within the right context, it will update automatically (without any issues), even without tagging the area to redraw: gist.github.com/p2or/b92d0859c68ac78673a2d0bedb2af09f Is your actual goal, running that from the text editor or another area? – p2or Feb 3 '18 at 14:48
• @p2or i think your snippet works because you are calling bpy.ops.node.add_node(bl_idname), my script builds an entire nodetree using nodes.new(bl_idname), which doesn't have the same scene update behaviour. – zeffii Feb 3 '18 at 15:15
• Updated the gist using new(). Does that work for you? @zeffii – p2or Feb 3 '18 at 15:22
• Ahh, now I get it. Updated the gist again. I think in this case adding context.area.tag_redraw() (as @J.Bakker suggested) does the trick @zeffii – p2or Feb 3 '18 at 15:35