pathhack helps Python find modules associated with the operation of the Knowbot software. With pathhack, modules needed by KOS components and tools can be found during import.
As a side effect of importing this module, sys.path is hacked to include all relevant directories.
In order to bootstrap this, the environment variable $PYTHONPATH must include the directory containing the pathhack module, or the script must contain a line like this before importing pathhack:
import sys, os sys.path.append(os.path.join(sys.path, "../../common"))
(The number of "../" segments should reflect the depth of the script file relative to $KOSROOT.)
This module has knowledge of where it lives relative to $KOSROOT. If its location changes, it needs to be updated. It contains a sophisticated warning feature that tells you immediately when such an update is necessary. :-)
pathhack is a module that does all it's work simply by importing it.