Hello, I have been trying to follow the Figma videos on creating my first plugin. However when we get to the point of logging the name of a team library component to the console I get the error: “cannot read property ‘children’ of null”.
The code works fine when I’m in the local file for that particular component, however once I go to another project file, I get the error. I have checked to make sure the team library is enabled in the assets panel, and I can easily import the component into the file through search or even through its ID in Automator.
I’m using the following code to try to log the component properties:
1 const postComponentSet = figma.root.findOne(node => node.type == "COMPONENT_SET" && node.name == "card") as ComponentSetNode;23 console.log(postComponentSet);4 console.log(postComponentSet.children);5 console.log(postComponentSet.name);6
I also tried importing by Key as well, and have tried this route:
1async function importNode() {2 let importComponent = await figma.importComponentByKeyAsync(key);3 importComponent.createInstance()4}5importNode()6
But for some reason it cannot find the component unless I’m in the file which the component is located.
Any advice is appreciated!
