how to define all scenes,objects,sensors,controllers,actuators

Can I assign a module to an empty or an object in my scene and when I run it to be able to define all the scenes, all their objects, all their sensors, their controllers and their actuators?
If yes, how? and if not, why?

Edit: Also if I change the values of a variable in one script.Will another script run by different or the same object be able to read the changes?

Edit with the Answer!

import bge
import bpy
import sys

def initialization(name):
    The function "initialization" is responsible for:
    1.Loading all scenes.
    2.Setting all scene objects, object sensors and object actuators to variables with corresponding(where the dot "." is replaced with "_").
    These variables are created into the function but are for global use. 
    3.The variable "cont" is created with its content being the controller.
    sys.modules[name].cont = bge.logic.getCurrentController()
    for s in
    for scene in bge.logic.getSceneList():
        for obj in scene.objects:
            for sensor in obj.sensors:
                exec("sys.modules[\"%s\"].%s_%s= obj.sensors[\"%s\"]"%(name,str(obj).replace(".","_"),str(sensor).replace(".","_"),sensor))
    for act in sys.modules[name].cont.actuators:

So,this is a module(with the name “” that I have saved in the same folder with the other modules I use and the .blend file. At the start of each module I want to use I just write this:

import bge
from initialization import initialization

Now every sensor,object,etc. that I mentioned above can be retrieved and used

Yes, it is possible (except for scenes; you can only get scenes that have already been added while the game engine has been running), though I’m not sure why you’d need to. You should probably explain exactly what you’re trying to accomplish. Regardless, here’s a basic implementation:

import bge

# get all scenes
scenes = bge.logic.getSceneList()

# get all objects
objects = [obj for scene in scenes for obj in scene.objects]

# get all sensors, controllers, actuators
sensors = [sens for obj in objects for sens in obj.sensors]
controllers = [cont for obj in objects for cont in obj.controllers]
actuators = [actu for obj in objects for actu in obj.actuators]

Bpy is the blender api. It will not available when you run the blenderplayer without blender.

I didn’t know that. Is there a way to automatically load all the scenes?

The best approach that might work would be to switch to each scene in the game, which would force Blender to load it into memory. No telling how long any non-active scene would stick around, though; they might be garbage collected after a short time.

A friend of mine modified the source code to make it possible,so I 'll close this.If it ever gets to an add-on I 'll let you know.