2

I am trying to run multiple functions at the same time. To save time modifying file by file, I converted the files into functions and imported them from another .py, but when I run it they execute in order, and they start when the previous one finishes

Is there a way to run them all at once from the same python (.py) script/file?

from DosAAMismoDTotal import DosAAMismoDTotal
from DosABAnteriorDTotal import DosABAnteriorDTotal
from DosACSiguienteDTotal import DosACSiguienteDTotal
from DosBAMismoDP import DosBAMismoDP
from DosBBMismoDU import DosBBMismoDU
from DosBCAnteriorD import DosBCAnteriorD
from DosBDSiguienteD import DosBDSiguienteD
fisrt = 'xpath1'
second = 'xpath2'
one = 'xpath3'
two = 'xpath4'
three = 'xpath5'
functionone(fisrt, second, one)
functiontwo(fisrt, second, two)
functiononethree(fisrt, second, three)
functiononefour(fisrt, second, one)
functiononefive(fisrt, second, one)
functiononesix(fisrt, second, two)
functiononeseven(fisrt, second, three)
asked Dec 16, 2020 at 22:20
2
  • 1
    You can use multi threading (on 1 core) or multiprocessing (multiple cores). Example threading, and an example for multiprocessing. Or check the official docs here (currentyl at threading, but you can also search for multiprocessing. Commented Dec 16, 2020 at 22:26
  • I only managed to execute the functions one after the other with "threading.Thread (target =" and "Process (target =". So I chose to create a .py and import the variables from it, for each function in separate files: from defvariable import (fisrt, second, one, two, three) Commented Dec 17, 2020 at 0:36

0

Know someone who can answer? Share a link to this question via email, Twitter, or Facebook.

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

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.