Question about paths in copied layer

Hi
I have some glyphs that has paths and components and I want to get only the components but decomposed to perform some other things in a script.

But when I try to make a copy, delete the “real” paths, and decompose the comps to get paths I get nothing. What I’m doing wrong here? Thanks in advance

font = Glyphs.font

for thisLayer in font.selectedLayers:
    # make copy
    copyOfLayer = thisLayer.copy()
    # Remove paths from copy
    for i in range( len( copyOfLayer.paths ))[::-1]:
        del copyOfLayer.paths[i]
    print copyOfLayer.paths
    
    # Decompose components
    copyOfLayer.decomposeComponents()
    print copyOfLayer.paths

The copy has no connection to the font, so it can’t get to the glyphs to get the paths.
add

copyOfLayer.parent = thisLayer.parent

after the .copy() line

Oh Thanks! It worked