Your question and your issues have no real relation to each other. Therefore I split them into separate sections.
Traceback (most recent call last): File "test.py", line 14, in File "test.py", line 10, in functions File
"\Functions.py", line 23, in main KeyError: 'requested item "Scene" does not exist'
There is an error in file test.py. As the error says you try to find an item with key "Scene". But there is no such item. I guess the code is supposed to find a scene. But there is no scene "Scene" loaded.
Check the scene names and what scenes are loaded at the moment of execution of this code. Ensure the scene is loaded and has the name "Scene".
Traceback (most recent call last): File
"Main.py",line 18, in map File
"Map.py",line 27, in init File
"Map.py",line 36, in oooopenmap File
"Functions.py",line 22, in init File
"Functions.py",line 26, in pausee ValueError: Pause not in this python controllers actuator list
I did not had that error in the past. I guess it is pretty much the same as the KeyError. You try to get an actuator called "Pause", which is not connected to the current actuator.
Ensure the currently running controller is connected to an actuator called "Pause".
How to combine modules?
This is a plain Python question.All you need is "import" as you already do.
You can import any module into any script/module. The imported module can be in
- a text block
- a file that resides in the python search path
- a package that resides in the python search path.
I strongly suggest to avoid storing context data (current controller, current scene) when it is supposed to be used as context. You can't be sure this is still valid within any subsequent uses of the class.
To be more specific: you store a reference of the current controller inside of the object "module". But when you call any function of that object from another controller, this class still refers to the original controller.
This can be the reason why you get the ValueError (see the section above).
Example: your controller "Python" executes Python code that creates a new object of class "module".
myModuleObject = Map.module()
A controller "Python.001" executes Python code that uses with this object:
This can fail as the current controller (Python.001) is not the stored controller (Python). You can only activate actuators that are connected to the current controller regardless what controller you store in your object.
Always read the current controller from context. Store it in a local variable, but not in a class or module variable. Do not store it in a game object property.
You can store the current object and the current scene when it is not meant to be used as "current". E.g. you want to store the current object as target.
I hope this helps a bit