def get_sandbox_python_path_for_python_action(
    pack, inherit_from_parent=True, inherit_parent_virtualenv=True
):
    """
    Return sandbox PYTHONPATH for a particular Python runner action.
    Same as get_sandbox_python_path() function, but it's intended to be used for Python runner
    actions.
    """
    sandbox_python_path = get_sandbox_python_path(
        inherit_from_parent=inherit_from_parent,
        inherit_parent_virtualenv=inherit_parent_virtualenv,
    )

    pack_base_path = get_pack_base_path(pack_name=pack)
    virtualenv_path = get_sandbox_virtualenv_path(pack=pack)

    if virtualenv_path and os.path.isdir(virtualenv_path):
        # Add the pack's lib directory (lib/python3.x) in front of the PYTHONPATH.
        pack_venv_lib_directory = get_virtualenv_lib_path(virtualenv_path)

        # Add the pack's site-packages directory (lib/python3.x/site-packages)
        # in front of the Python system site-packages This is important because
        # we want Python 3 compatible libraries to be used from the pack virtual
        # environment and not system ones.
        pack_venv_site_packages_directory = os.path.join(
            pack_venv_lib_directory, "site-packages"
        )

        # Then add the actions/lib directory in the pack.
        pack_actions_lib_paths = os.path.join(
            pack_base_path, "actions", ACTION_LIBS_DIR
        )

        full_sandbox_python_path = [
            # NOTE: Order here is very important for imports to function correctly
            pack_venv_lib_directory,
            pack_venv_site_packages_directory,
            pack_actions_lib_paths,
            sandbox_python_path,
        ]

        sandbox_python_path = ":".join(full_sandbox_python_path)

    return sandbox_python_path

    Return sandbox PYTHONPATH for a particular Python runner action.
    Same as get_sandbox_python_path() function, but it's intended to be used for Python runner
    actions.
    
st2common/st2common/util/sandboxing.py