Yes, when you import my_script, it is effectively “run”. So what you can do is launch 1 instance of mayapy, and pass it a single script that imports the others.
$ mayapy my_script.py
my_script.py
import other_script1
import other_script2
guess what im asking is if there you can specify the process id for example to the Popen method and have it use the process if it already exists or create one if it doesnt
This probably isn’t what you’re looking for. Yes, you can get the process ID from a Popen instance, but unless you devise an interprocess communication server/client between your processes, you haven’t got that many options left for telling the mayapy you find to run another script.
--
You received this message because you are subscribed to the Google Groups "Python Programming for Autodesk Maya" group.
To unsubscribe from this group and stop receiving emails from it, send an email to python_inside_m...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAFRtmOCFwBwRq-rzjgu9hbg8G7BDWkXLNR5VGTAN55SzMjbX3Q%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.
socket connection is the first thing i thought of, but that
implies coding some socket listening logic in the child process,
was hoping to avoid that.
im exploring some other possibilities like talking via pipes which is what i think you are talking when issuing commands to the stdin, or the other one ive seen is using shared memory between the two processes with some sort of datastructure like a queue.
Ive read some interprocess communication in Operating Systems CS subject but of all, the option im more familiar with is using sockets... and i think for what im trying to do is a bit overkill.
Thanks to both.
To view this discussion on the web visit https://groups.google.com/d/msgid/python_inside_maya/CAPGFgA02F0DUD9C63AS6fWhi7VRPjBWq04j00zt-RAqyQTKR6w%40mail.gmail.com.