In this simple code below, named "example.py" I want to get the current scene and create a sphere.
I am using
bge.logic.getCurrentScene() but there is an error named:
name 'bge' is not defined.
I need to run this example on cmd, for example: "Blender Path" -P example.py
I have a blender big program, but there is a problem in this specific part, so I need be sure that this part will work.
import bpy import bge mej = bpy.ops.mesh.primitive_plane_add(1) scj = bge.logic.getCurrentScene() obj = scj.objects.new(mej,'sphere')