Start (multiple) parallel processes

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • Jogi
    New Member
    • Mar 2010
    • 6

    Start (multiple) parallel processes

    Hi there,

    How can i use os.popen or os.startfile to start a parallel running python script from within my running script?
    i don't get the usage of these two -.-
    with popen it seems as if the parent programm pauses and only the child programm is running, but i need both to run -.-

    Code:
    run="python "+file_to_run
    os.popen(run)
    Last edited by Jogi; Mar 29 '10, 08:23 PM. Reason: Partly solved
  • bvdet
    Recognized Expert Specialist
    • Oct 2006
    • 2851

    #2
    Look at the thread module.

    Comment

    • Glenton
      Recognized Expert Contributor
      • Nov 2008
      • 391

      #3
      More details on the thread module can be found
      here

      Of course, the docs are also worth looking at.

      Comment

      • Jogi
        New Member
        • Mar 2010
        • 6

        #4
        As i understand it that's not exactly what I need...
        Threats are parallel processes within a single file, aren't they?

        What I want is the following:
        I have the Files 'File1.py', 'File2.py', 'FileXY.py' ...
        I start File1.py, and this File1 then starts File2.py, but it should go on to run (and not to wait for File2.py to finish). File2.py again starts File3.py and so on...
        I don't need any result from these Files, I just need to start them.

        Thx

        Comment

        • Glenton
          Recognized Expert Contributor
          • Nov 2008
          • 391

          #5
          Yeah. That's what threads are for! Start a thread and do the popen stuff. Then carry on with the rest of the file.

          Comment

          • Jogi
            New Member
            • Mar 2010
            • 6

            #6
            ah, ok... thats the way (aha aha) i like it ;-)
            Thx all!

            Comment

            Working...