How to Parent All Layers to First Layer in Another Comp Using Automation Blocks (Sometimes Not Worki
Hi everyone,
I’m working with Automation Blocks for After Effects and running into an issue when trying to parent all layers in one composition to the first layer.
Here's what I'm trying to do:
I have two compositions:
4kcomp
2kcomp
I want to parent all layers in 2kcomp to the first layer inside it, using a script built with Automation Blocks.
What works:
When I open 2kcomp first and run the script, it works correctly — all layers are parented to the first one.
What doesn’t work:
If I open 4kcomp and run the script (without manually opening 2kcomp first), the script runs but doesn’t parent anything. It seems like the layers in 2kcomp aren’t being accessed or recognized properly unless that comp is opened manually beforehand.
Question:
Is there a reliable way in Automation Blocks to make sure all layers of a non-active comp (like 2kcomp) are accessible and parented correctly?
Do I need to “force open” or “activate” 2kcomp before looping through its layers?
Here’s a simplified version of what I’m doing in the block logic:
Get comp by name (2kcomp)
Loop through all layers (starting from index 2)
Set each layer’s parent to layer index 1
Any help, tips, or a better workaround would be greatly appreciated!
Thanks in advance!

