vy32
vy32

Reputation: 29645

Can I embed multiple copies of the Python interpreter in a multi-threaded program?

I have a multi-threaded program. I want to embed a python interpreter. I don't want to use Python's threading; I want to have multiple copies of the Python interpreter running.

Thanks.

Upvotes: 2

Views: 595

Answers (1)

Ignacio Vazquez-Abrams
Ignacio Vazquez-Abrams

Reputation: 798606

Python's interpreter uses global state, and as such you can only have one interpreter per process. You can try using multiprocessing to run multiple processes, each with their own interpreter, but I'm not sure how well that would play with embedding.

Upvotes: 6

Related Questions