Is it possible with Python to detect if a nodegroup is embedded in a frame in another blend file without adding it first?
I have several blend files with the following structure:
The main group always contains a certain name (in this example "_TEST"), and in it are other nodegroups. Some of them are embedded in frames, some are not.
And from another file, before I add/process a certain nodegroup from these files, I want to check if it is embedded in a frame or not.
Basically reading the file works fine, and I can add the nodes, but in this step I always get only the name of the group, but not its properties, like parent
:
with bpy.data.libraries.load(filepath) as (data_from, data_to):
for group_name in data_from.node_groups:
print(group_name)
If I have a node group in the same blend file, it works fine with the following code:
maingroup = bpy.data.node_groups['_TEST'].nodes
for n in maingroup:
if n.parent == maingroup['Frame']:
print("Node '" + n.node_tree.name + "' is framed")
But when I try to read the information of a node group that is in another file, unfortunately it doesn't work.
Any suggestions for a solution?