ModuleNotFoundError when importing from slicer.parameterNodeWrapper

I am developing a scripted module in Slicer 5.2.2 and one key issue is that when I save/load the scene I want to preserve the class attributes in addition to the views and segmentations so I can fully restore the UI to its previous state. As suggested by this thread:

I have modified my widget class similar to the VectorToScalarVolume class. However, the main issue is that I get a ModuleNotFound error on starting up Slicer.

The error is coming from the line:

from slicer.parameterNodeWrapper import parameterNodeWrapper

The full traceback looks like this:

Traceback (most recent call last):
  File "<string>", line 1, in <module>
  File "/Applications/Slicer.app/Contents/lib/Python/lib/python3.9/imp.py", line 169, in load_source
    module = _exec(spec, sys.modules[name])
  File "<frozen importlib._bootstrap>", line 613, in _exec
  File "<frozen importlib._bootstrap_external>", line 850, in exec_module
  File "<frozen importlib._bootstrap>", line 228, in _call_with_frames_removed
  File "/Users/{myname}/Desktop/{modulename} project/Code/{modulename}-main/{modulename}/{modulename}.py", line 32, in <module>
    from slicer.parameterNodeWrapper import parameterNodeWrapper
ModuleNotFoundError: No module named 'slicer.parameterNodeWrapper'
[Qt] loadSourceAsModule - Failed to load file "/Users/{myname}/Desktop/{modulename} project/Code/{modulename}-main/{modulename}/{modulename}.py"  as module "{modulename}" !
[Qt] Fail to instantiate module {modulename}
[Qt] The following modules failed to be instantiated:
[Qt]    {modulename}

It’s a confusing error, since this line seems to work just fine in VectorToScalarVolume and the official documentation. I’m working with Slicer 5.2.2 and haven’t had issues importing from slicer.util or elsewhere. I also checked the changelog for v5.2 but no luck.

What could be causing this issue?

slicer.parameterNodeWrapper is not available in Slicer 5.2.2. It is currently only available in latest Slicer Preview. That is why it is not working for you when using Slicer 5.2.2.

VectorToScalarVolume code for Slicer 5.2.2

versus VectorToScalarVolume code for latest Slicer Preview (aka main branch)

I see - does VectorToScalarVolume in 5.2 implement this functionality too? (saving class attributes when saving mrml scene)