# Inconsistent/ Random behavior in Blender

I am generating some shape using python in Blender. Most of the times, when I run the code I get what I expect. But sometimes I see the broken mesh as I have shown in the figure.

As far as code's functionality is concerned, I am not using any random function/ number. Code is expected to give out deterministic result every time I run it.

Any suggestions on what might be causing this inconsistent behavior?

• Possibly something in your code that triggers undefined behavior? docs.blender.org/api/current/… – Robert Gützkow Dec 5 '19 at 17:56
• Are you using any bpy.ops commands? Some are context sensitive, require certain windows or react to e.g. the mouse position.# – Leander Dec 5 '19 at 18:26
• @RobertGützkow -- yes I think bpy.ops is the cause. – Rahul Dec 11 '19 at 21:33
• @Leander I am using bpy.ops. I think that might be the cause for the inconsistency. I have found this post and I will correct this and get back. – Rahul Dec 11 '19 at 21:35