BPY add keyframe to each curve after importing a sequence of .SVG files here my first ever attempt to patch a simple python script for Blender 2.9 that could import a series of of svg files that conform an animation.
I want to be able to enable and disable their visibility so to simulate an animation, this is to be sent to a software called OsciStudio that generates sound from the objects on the viewport.
What I have tried is this:
import bpy
import glob
import os  

# path to your folder

importDir = &quot;/Volumes/250GB/16mm/rotoscope/stillsprecol/select/&quot; 
print(&quot;Importing all SVG from this directory&quot;, importDir)

os.chdir(importDir)

for files in glob.glob(&quot;*.svg&quot;):
    print( files, &quot;... imported!&quot; )
    bpy.ops.import_curve.svg(filepath=files)
    bpy.ops.object.select_all(action='SELECT')

for i, obj in enumerate(bpy.context.selected_objects, 1):
    bpy.context.view_layer.objects.active = obj
    obj.name = &quot;Curve&quot; + str(i)


    obj.location = (3.0, 4.0, 10.0)
    obj.keyframe_insert(data_path=&quot;location&quot;, frame=1)

Importing works fine, i get all the files layered and selected, then moved to the specified location and theres one key frame added on the timeline!
But have no idea on how to add a keyframe to each layer, progressively and separated by 10 frames.
I'm using blender 2.9 under OS X
TIA for any, really any, help
check this out:
for files in glob.glob(&quot;*.svg&quot;):
    print( files, &quot;... imported!&quot; )
    bpy.ops.import_curve.svg(filepath=files)
    bpy.ops.object.select_all(action='SELECT')

for i, obj in enumerate(bpy.context.selected_objects, 1):
    bpy.context.view_layer.objects.active = obj
    obj.name = &quot;Curve&quot; + str(i)


    for x in [10,20,30,40,50]: # the indentation in this line is important!!!
        obj.location = (0.0 + x , 0.0, 0.0) # ADAPT HERE
    
        obj.keyframe_insert(data_path=&quot;location&quot;, frame=x)

of course you have to adapt the line with &quot;adapt here&quot; to use some mathematics so that you get your progressiveley -&gt; i have no idea what values you want to have there ;)
and of course you can do the &quot;for x in &quot; with a nicer loop...my version is for sure not the most elegant one - but the laziest one ;)