How can I programmatically insert a new grease pencil object (svg) at coordinates/rotation I'm trying to create and place a series of sketches from a tablet to a blender file. I know where they should go in 3d-space. I am trying to construct a python script to input a file name and coordinates then place thing at location.
From some code I found (https://blender.stackexchange.com/a/166492/2586). I think this is very close. The script leaves off at allowing the user to draw. Instead I want to import a file.
import bpy
context = bpy.context
space = context.space_data

# Create material for grease pencil
if &quot;Bright Material&quot; in bpy.data.materials.keys():
    gp_mat = bpy.data.materials[&quot;Bright Material&quot;]
else:
    gp_mat = bpy.data.materials.new(&quot;Bright Material&quot;)

if not gp_mat.is_grease_pencil:
    bpy.data.materials.create_gpencil_data(gp_mat)
    gp_mat.grease_pencil.color = (1, 0, 0.818649, 1)

# Add grease pencil object
gp_data = bpy.data.grease_pencils.new(&quot;Bright Pencil&quot;)
gp_ob = bpy.data.objects.new(&quot;Bright Pencil&quot;, gp_data)
context.scene.collection.objects.link(gp_ob)
if space.local_view:
    gp_ob.local_view_set(space, True)

for ob in context.selected_objects:
    ob.select_set(False)
gp_ob.select_set(True)
context.view_layer.objects.active = gp_ob
bpy.ops.object.mode_set(mode='PAINT_GPENCIL')

# Assign the material to the grease pencil for drawing
gp_data.materials.append(gp_mat)

next instead of bpy.ops.gpencil.draw(wait_for_input=False)
can I do something like bpy.context.image_paint_object or bpy.ops.object.load_reference_image
or otherwise import an SVG image and set the rotation of it? can I add a frame number for animation?
Import method
It sounds like the easiest option for you would be to load a series of SVG images using the SVG Import Add-On (so you don't need any coding). Currently the SVG Import creates Curve objects - which can be used as-is, or optionally they can be converted to Grease Pencil strokes (via [right-click] &gt; [Convert to Grease Pencil]).
Scripting method
Alternatively - if you wish to do things via a script continuing from the GreasePencil object and Material creation you have illustrated above, then you will need to add Layer, Frame and Stroke/s. (note: my gpencil == gp_ob):
#Get/Set Layer    
if gpencil.layers:
    layer = gpencil.layers.active
else:
    layer = gpencil.layers.new('mylayer', set_active = True)
    
#Get/Set Frame
if layer.frames:
    frame = layer.active_frame
else:
    frame = layer.frames.new(1)
    
#Draw some Strokes (and optionally add a closing stroke) to form a triangle
stroke = frame.strokes.new()
stroke.line_width = 6
stroke.draw_cyclic = 1 #close - automatically draw a final last stroke back to start point
stroke.points.add(count=3) 
stroke.points[0].co = (-1.0, 0.0, 0.0)  #point coordinates - i.e. x, y, z
stroke.points[1].co = (1.0, 0.0, 0.0)    
stroke.points[2].co = (0.0, 0.0, 1.0)

p.s. As good practice, you should also reference where you get your code snippet/s from.
ref: Blender Version 2.83