PDA

View Full Version : Resource scripts issue


Greken
12-23-2007, 06:57 PM
Hi everything

I'm writing my first complex program inside Maya where I can't hold everything inside one file anymore. This whole project involve both Python and MEL. My current setup on my Mac is that I added the script path for my project to the env-file for Maya.
When I make changes in the MEL-files I have no problem to run the rehash-command and then source <mainfile>.
However this won't work when I update the Python-files for the project. Inside my mainfile that I reload I have a python-command that imports a python file that imports the rest of the files. The only solution right now is to restart Maya, which isn't quite fun in the long run.
I haven't found that much info yet on this kind of mixing the script languages either on Internet. I have run through the manual but I couldn't find a clever answer there. Has anyone else encoutered this before?

Cheers, and Merry Christmas everyone :)

zanarkand
12-23-2007, 11:40 PM
I believe the command you're looking for is "reload"
After you've imported your module once, reload will make python "import" your script again.

import myModule
reload (myModule)

Greken
12-29-2007, 04:34 PM
Hey

Thanks a lot for the tip. This seems to work for most of the time. However I still get some funny errors sometimes, so I'm trying to nail down what it could be. In your exemple you simply imported an module. I'm not a good Python user yet, so I have to write:
from myCreatedModule import *
To make my scripts work. Could that be a drawback when you use this reload-thing?

CGTalk Moderation
12-29-2007, 04:34 PM
This thread has been automatically closed as it remained inactive for 12 months. If you wish to continue the discussion, please create a new thread in the appropriate forum.