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

Cameron Simpson cs at cskk.id.au
Thu Nov 7 17:44:11 EST 2019


On 08Nov2019 00:52, Greg Ewing <greg.ewing at canterbury.ac.nz> wrote:
>Cameron Simpson wrote:
>>Spencer's modules run unconditional stuff in addition to defining 
>>classes. That may cause trouble.
>
>It will -- because of the import lock, they won't run simultaneously
>in the same process.

I was unsure as to how serialised this was: just the import data 
structures or the whole source-of-the-module. But I guess serialising 
the latter is essential anyway, now I think about it.

Hence my separate post suggesting the OP move the "main task" into a 
function, runs the imports serailly (very cheap) and then kick off 
threads if that's what he wants.

Thanks for the clarification.

Cheers,
Cameron Simpson <cs at cskk.id.au>


More information about the Python-list mailing list