is it possible to use python multiprocessing in IP10?

I'm trying to start a long running Python program, that runs in the background (i.e. doesn't take focus/time away from Igor), with which I can also communicate. The only communication I wish to do is shut the python program down.

I have Python code along the lines of

# task.py
import time

def task(queue, shutdown_event):
    while True:
        time.sleep(1.0)
        if shutdown_event.is_set():
            print("Shutting down")
            break
        print("Number 5 is alive")

 

I then try to start it running via the following lines in the python:

from multiprocessing import Process, Queue, Event
import task

shutdown_event = Event()
queue = Queue()

tasker = Process(target=task.task, args=(queue, shutdown_event))
tasker.start()

 

However, I get the following turning up in the Igor command window:

  Error -43 trying to open a file specified in start-up command: C:Program Files:WaveMetrics:Igor Pro 10 Folder:-c
  Error -43 trying to open a file specified in start-up command: C:Program Files:WaveMetrics:Igor Pro 10 Folder:from multiprocessing.spawn import spawn_main; spawn_main(parent_pid=6524, pipe_handle=3084)
  Error -43 trying to open a file specified in start-up command: C:Program Files:WaveMetrics:Igor Pro 10 Folder:--multiprocessing-fork

 

Does the python integration of IP10 allow further subprocesses or processes to start? A poorer alternative is using ExecuteScriptText, but it becomes a pain to stop the program running. I'd have to communicate via a value in a file or something along those lines.

KB

I think that the multiprocessing library points to the process that it is being run on. So all you should have to do is point the library to the Python executable to create separate Python processes.

This is what it would look like:
 

import multiprocessing as mp
import time
import math

# Set executable (This one makes pop out windows for each process)
mp.set_executable(r"C:{PATH TO PYTHON}\Python\bin\python3.14.exe")
# Or for no terminal popups:
#mp.set_executable(r"C:{PATH TO PYTHON}\Python\bin\pythonw3.14.exe")

def do():
    start = time.perf_counter()
    with mp.Pool(5) as p:
        res = p.map(math.factorial, range(12000))
    print(time.perf_counter() - start)

# Fix: Mandatory guard for Windows multiprocessing
if __name__ == '__main__':
    do()