Layers marked for export in code but not in the IDE

Hi again.

I’m developing a plugin that marks bitmaps and imported SVG files for export.

But one issue I’m facing is that even though the property markedForExport of the found layers is set to true, some of the layers are not actually marked for export.

I’m not getting any errors in the console.

Does anyone know what’s going on?


UPDATE: I found that this actually happens with children of components.

Does anyone know why?