Skip to content

Using PyKX in python subprocesses

This page outlines using PyKX in a Python subprocess.

To use PyKX in a python subprocess you should spawn the process using the kx.PyKXReimport function as follows:

import pykx as kx
import subprocess
with kx.PyKXReimport():
    subprocess.Popen(['python', 'file.py']) #_Run a python subprocess that loads a python script containing a PyKX import

Failing to reimport the PyKX package running in the parent process can cause the subprocess to crash with a segmentation fault. The PyKXReimport function and possible causes of segmentation faults is covered in more detail here.