the only problem is , when my addon is initialised, blender has already added it’s paths to the sys.path. What’s the best way to get the sys.paths state before blender has added to it?
Not sure if you still need it, but I was able to work around this issue by checking the process name at the start of the script, as blender itself has ‘MainProcess’ as the process name, but any processes created by multiprocessing have different names, so I use this check to manage the bpy imports so the module is only ever imported by the main process
from multiprocessing import current_process
if current_process().name == 'MainProcess':
import bpy
The only issue with this is that you cant access the bpy module from another process, but you can use shared memory to share some information back and forth for large calculations