I'm creating an object from code
obj = bpy.data.objects.new("ObjectName", SomeMeshData)
bpy.context.scene.collection.objects.link(obj)
Now, i want to convert this object into a Curve, using blender console i can see it's quite simple: bpy.ops.object.convert(target='CURVE')
from code this doesn't work causing: RuntimeError: Operator bpy.ops.object.convert.poll()
Using obj.convert(target='CURVE')
causes different error:
AttributeError: 'Object' object has no attribute 'convert'
Should i 'select' the object and then use this function? This doesn't sound like proper approach cause i want to do this for thousands of objects and i also tried selecting and couldn't make it working.
New Blender 2.8 API is so confusing, after hours of searching all forums i can not find any way to make it work. This should be fairly easy task but seems to be impossible for some reason. I'm a newbie, please help.