I have this piece of code that's meant to start the game engine (and it does so if I just run this on the default screen)...I have a script that generates an environment with planes, spheres, etc. and appended this piece of code on the bottom but I'm getting a poll() context error...I'm in 3d view by default and the below thing should make it run in the game engine...any way to fix this so it actually works?
bpy.context.scene.render.engine = 'BLENDER_GAME'
for area in bpy.context.screen.areas:
if area.type == 'VIEW_3D':
override = bpy.context.copy()
override['area'] = area