Reimporting
pykx.reimporter
PyKX reimport helper module.
PyKX 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 PyKX within a spawned subprocess.
This module provides a mechanism to allow users to safely reimport PyKX 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 PyKX 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 PyKX
subprocess.Popen(f"python other_file.py")
reset
reset()
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.
Reset all the required environment variables.
restore
restore()
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 all the required environment variables.