# Parallel processing(QThreadPool, multiprocessing...) in Krita Python scripts

**URL:** <https://krita-artists.org/t/parallel-processing-qthreadpool-multiprocessing-in-krita-python-scripts/137583>\
**Category:** Plugins Development\
**Tags:** scripting-help\
**Created:** [August 20, 2025, 1:23pm UTC](https://krita-artists.org/t/parallel-processing-qthreadpool-multiprocessing-in-krita-python-scripts/137583 "2025-08-20T13:23:55Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![tankman22](https://krita-artists.org/letter_avatar_proxy/v4/letter/t/919ad9/32.png) [@tankman22](https://krita-artists.org/u/tankman22)\
**Post date:** [August 20, 2025, 1:23pm UTC](https://krita-artists.org/t/parallel-processing-qthreadpool-multiprocessing-in-krita-python-scripts/137583/1 "2025-08-20T13:23:55Z")

</div>

My environment is Krita 5.3.0 (prealpha) / Windows 11 (x64).

I’m developing a Krita plugin with Python.

Currently, I’m implementing multithreading for this script, but due to Python(GIL) constraints, I have not seen any noticeable effects from parallel processing using QThreadPool.

Therefore, I tried using the multiprocessing module from Python’s standard library for parallel processing.

```python
import multiprocessing as mp

class TestFilterProc():
	def __init__ (self, param, cancel_event, event_queue):
		self.param = param
		self.process = mp.Process(target=self.run)
		self.cancel_event = cancel_event
		self.event_queue = event_queue

	def run(self):
		pass # Heavy process

class TestFilter(QObject):
	progress = pyqtSignal(int, int)
	completed = pyqtSignal()
	finished = pyqtSignal()

	def __init__ (self, param):
		super(). __init__ ()
		self.mp_manager = mp.Manager()
		self.mp_queue = mp.Queue()
		self.cancel_event = self.mp_manager.Event()

		self.myproc = TestFilterProc(param, self.cancel_event, self.mp_queue)

	def applyFilter(self):
		self.myproc.start()

```

But when attempting to execute functions such as “multiprocessing.Manager()”, “multiprocessing.Queue()”, or “multiprocessing.Process()/start()” required for communication with the main thread, a warning stating “_krita: unknown option: c, multiprocessing-fork._” appears, causing the entire application to freeze.

Note that it works fine when executed directly in the Python interpreter without using Krita.

Please let me know if there is a solution to this problem, or if there are any effective parallel processing methods or APIs available for Krita plugin development.

---

<div class="post-metadata">

**Author:** ![Harold\_Krivell](https://krita-artists.org/user_avatar/krita-artists.org/harold_krivell/32/228393_2.png) [@Harold\_Krivell](https://krita-artists.org/u/Harold_Krivell)\
**Post date:** [July 10, 2026, 2:55am UTC](https://krita-artists.org/t/parallel-processing-qthreadpool-multiprocessing-in-krita-python-scripts/137583/2 "2026-07-10T02:55:40Z")

</div>

I’m getting a similar error when trying to export the script.

---

<div class="post-metadata">

**Author:** ![Drawpile](https://krita-artists.org/user_avatar/krita-artists.org/drawpile/32/140367_2.png) [@Drawpile](https://krita-artists.org/u/Drawpile)\
**Post date:** [July 10, 2026, 12:40pm UTC](https://krita-artists.org/t/parallel-processing-qthreadpool-multiprocessing-in-krita-python-scripts/137583/3 "2026-07-10T12:40:51Z")

</div>

The error occurs because Python uses `sys.executable` to execute the other processes, which means it tries to run another Krita process. You have to use [multiprocessing.set\_executable](https://docs.python.org/3/library/multiprocessing.html#multiprocessing.set_executable) to make it run a Python interpreter instead.
