I couldn't find anything online and well... when I bring up my code, which makes a simple sphere in BGE blenders game engine it doesn't run til after I close the game and that's where it creates the mesh. Is there something you're supposed to put into the code for blender to run it outside of the viewport?
here's my code, it runs and does what I want it to... only after I've closed BGE which noone else seems to have run into.
import bpy
for obj in bpy.context.selected_objects:
bpy.ops.mesh.primitive_uv_sphere_add(location=origin)
bpy.ops.transform.translate(value=(ObjX,ObjY,ObjZ))
setMaterial(bpy.context.object, blue)
bpy.ops.object.shade_smooth()
if __name__ == "__main__":
run((0,0,0))