1

I am trying to run multiple python scripts simultanuosly using QProcess from inside a GUI. The following will execute the first script and throw QProcess::start: Process is already running for the other two scripts.

def run(self):
    self.p = QtCore.QProcess()
    scripts = ['python ./scripts/s1.py', 'python ./scripts/s2.py', 'python ./scripts/s3.py']
    for s in scripts:            
        self.p.start(s)

1 Answer 1

1

You can't reuse the same QProcess if it's already running, as the error reports.

Just create a list of processes instead:

    def run(self):
        self.processes = []
        scripts = [
            'python ./scripts/s1.py', 
            'python ./scripts/s2.py', 
            'python ./scripts/s3.py'
        ]
        for script in scripts:
            process = QtCore.QProcess()
            self.processes.append(process)
            process.start(script)
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.