I have a text data block called "startup" that is called when the blender game engine starts. In the code, I print "starting...", which I see in the console and declare a class called Foo. I have another block of code called "keyboard_left" that is called when the left arrow key is pressed. In this code, I'm trying to import the Foo class declared in startup, but I get an error saying that module doesn't exist.
In the "startup" data block
| Code: |
print('starting...')
class Foo(object):
pass
|
In the "keyboard_left data block"
| Code: |
from startup import Foo
|
And when I press the left key, I get the following error...
| Code: |
Traceback (most recent call last):
File "keyboard_left", line 3, in <module>
ImportError: No module named startup
Blender Game Engine Finished
|
Code in the startup data block as already run though. Does blender throw this away after a controller is called? If so, how do I declare classes/globals to be used by other python controllers? Or am I just namespacing the import incorrectly?
i believe import requires scripts to be saved as files on harddrive, having just a blender text block doesn't work i think
_________________
I'm sitting, waiting, wishing, building Blender in superstition...
Alright. I may just keep things in a dictionary in a global list just to keep everything inside blender. Thanks.