Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8367215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 9, 20262026-06-09T13:06:12+00:00 2026-06-09T13:06:12+00:00

I have a python script that calls another python script. Inside the other python

  • 0

I have a python script that calls another python script. Inside the other python script it spawns some threads.How do I make the calling script wait until the called script is completely done running?

This is my code :

while(len(mProfiles) < num):
        print distro + " " + str(len(mProfiles))
        mod_scanProfiles.main(distro)
        time.sleep(180)
        mProfiles = readProfiles(mFile,num,distro)
        print "yoyo"

How do I wait until mod_scanProfiles.main() and all threads are completely finished? ( I used time.sleep(180) for now but its not good programming habit)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-09T13:06:13+00:00Added an answer on June 9, 2026 at 1:06 pm

    You want to modify the code in mod_scanProfiles.main to block until all it’s threads are finished.

    Assuming you make a call to subprocess.Popen in that function just do:

    # in mod_scanPfiles.main:
    p = subprocess.Popen(...)
    p.wait() # wait until the process completes.
    

    If you’re not currently waiting for your threads to end you’ll also want to call Thread.join (docs) to wait for them to complete. For example:

    # assuming you have a list of thread objects somewhere
    threads = [MyThread(), ...]
    for thread in threads:
        thread.start()
    for thread in threads:
        thread.join()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a C++ app that uses Python to load some scripts. It calls
I have a Python script that is using some closed-box Python functions (i.e. I
I have a python script that makes a series of url calls using urllib2.
I'm writing a python script that calls another python script (script2). I want to
I have a Python script that calls an executable program with various arguments (in
Greetings. I have written a little python script that calls MySQL in a subprocess.
I have the following simple python test script that uses Suds to call a
I have a python function that makes a subprocess call to a shell script
I have a python script that runs a program, which generates few .exe files
I have a python script that I want always to run in the background.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.