Reimporting
pykx.reimporter
KDB-X Python reimport helper module.
KDB-X Python uses various environment variables to monitor the state of various modules initialization. This is required to manage all of the different modes of operation, however it can cause issues when attempting to reimport KDB-X Python within a spawned subprocess.
This module provides a mechanism to allow users to safely reimport KDB-X Python within spawned subprocesses without having to manually manage any of these internal environment variables.
PyKXReimport
PyKXReimport()
Helper class to help manage the environment variables around reimporting KDB-X Python in a subprocess.
It is strongly recommended to use this class by using the python with syntax. This will ensure
all the environment variables are reset and restored correctly, without the need to manage this
yourself.
Examples:
with kx.PyKXReimport():
# This process can safely import KDB-X Python
subprocess.Popen(f"python other_file.py")
reset
reset()
Reset all the required environment variables.
It is not recommended to use this function directly instead use the with syntax.
This will automatically manage setting and restoring the environment variables for you.
restore
restore()
Restore all the required environment variables.
It is not recommended to use this function directly instead use the with syntax.
This will automatically manage setting and restoring the environment variables for you.