Python scripts by filename under Windows (vs Ubuntu)

I’m working on my current project on an Ubuntu box using Blender v2.49a. For most of my python logic blocks, I’m using python scripts saved externally from the .blend files (as shown in the attached image). Everything works fine so far on my Ubuntu box, but things fail whenever I try to run the .blend under Windows (also using v2.49a). I get an ImportError message in the console, saying that importing scripts by filename is unsupported. What do I need to do so that external python scripts work correctly under both platforms?

Attachments


Can you please make a test case and upload, Module controllers work on Windows & Linux for YoFrankie 1.1 so not sure whats going on.

If you can do this before friday it means any fix can get into 2.49b

I tried to do that same thing and got the same error. If you point the file path as a module instead of a file then it will work. Use:
“scripts.MainScript.main”

With a “.” instead of a “/”. Note that by doing this you’ll need to have an init.py file on the scripts directory for python to recognize that as a module. This way it will work on both platforms and this is also how yoFrankie is using it.

hah, didnt even notice that paths were being used!, surprised it even worked.

Thanks a lot everyone. Things seem to be working now, but let me make sure I’m understanding this correctly.

Import by filename is not cross-platform, so my logic blocks need to import the scripts directory as a module (using “.” and not “/”). The scripts directory needs an init.py file, which contains lines that import all of my previously written scripts (import AnimateScript , import MoveScript , etc).

Is that right, and is there anything else I’m overlooking?

Is that right, and is there anything else I’m overlooking?
I don’t think so.

Related topic : scripts.movescript.py can be accessed from a blend in a parent folder (say, char.blend) and scripts is a child folder.

*************
Question
*************

How to refer to /mygame/chars/scripts/movescript.py
from /mygame/props/walls.blend