How execute at least two python files at once when imported?

Michael Torrie torriem at gmail.com
Wed Nov 6 15:37:19 EST 2019


On 11/6/19 9:16 AM, Spencer Du wrote:
> I just wanted a way to import at least two python files in parallel
> and I wanted to know how this can be done or a reason why its bad as
> stated in another post.
It's not "bad," but it's also not possible.  Nor does it make sense.
That's why so many people are questioning what you are really trying to
accomplish.  By definition a Python script is a sequence of statements
that are read and executed in sequence.  You can't just run them all at
once, nor would it make sense to do so.

If you want to run multiple python functions in parallel, there are
threads for that, multiprocessing, and also asynchronous scheduling.

But no one can tell you what to do because none of us have any clue what
you are trying to accomplish.


More information about the Python-list mailing list