How to install python module in Blender 4.2?

Blender seems to have rearranged how you install additional python modules in 4.2 and some old code I was using no longer seems to work.

This was working in 4.1:

import subprocess
import os
import sys
python = os.path.abspath(sys.executable)
subprocess.call([python, "-m", "pip", "install", "gruut"])
print("Done")

This code still works in the sense that it will install the library, but the library is still inaccessible. If I type import gruut in the script window, it prints an error that the module cannot be found. (Strangely, if I run the command help('modules'), it is printed to the console as being present and after that the import gruut command starts working).

Traceback (most recent call last):
  File "<blender_console>", line 1, in <module>
ModuleNotFoundError: No module named 'gruut'

The same is true for other modules I want to install. Have things changed in 4.2? What is the right way to install modules in Blender now?