Enter Python's 'exec' command: It allows you to execute a module on disk as if it was interactively entered. So I came up with a plan:
- In Wing, I have a script bound to a hot-key: It takes what the user has highlighted, and saves it off to a temp text file on disk. It then (through a socket) pings Maya, and tells it to evaluate that code.
- When Maya launches it opens up a socket. Then when it gets the call from Python to do work, it finds the temp file, and runs 'exec' on it, and also prints the contents for the user.
FINALLY, Python can talk to Maya ;) I documented the whole thing (with code) on my Mel Wiki HERE.