After the script that was working as mentioned in my earlier post. I am trying to create a blend file that has the scene setup and a script that has the locations of the objects available in the blend scene. I am able to see the new positions created by the script to the objects in the blend scene. But I am not able to bake them all. I get the below error.
RuntimeError: Operator bpy.ops.rigidbody.objects_add.poll() failed, context is incorrect
This is relevant to the lines
bpy.ops.rigidbody.objects_add(type='ACTIVE')
bpy.ops.ptcache.bake_all(bake=True)
Let me know if you have come across this kind of error. How do I make the context correct. When I try to the print the objects that are in the scene, I am able to see the objects in the blend file. What does the context here mean?
Thanks in advance!