Install a single python dependancy for a cmake app

I successfully managed to package my C++ application. My app runs a little python script and that script needs pywebview. I added python3-webview as a stage package but python interpreter says that python webview does not exist! How can i add this depandancy to be available for python interpreter??

Traceback (most recent call last):
  File "<string>", line 6, in <module>
ModuleNotFoundError: No module named 'webview'
base: core22
    after: ["stuff"]
    plugin: cmake
    source-type: local
    source: .
    override-build: |
      cmake ../src -G Ninja
      cmake --build . --config Release
      install -Dm777 myapp $SNAPCRAFT_PART_INSTALL
      - ninja-build
      - libsdl2-dev
      - libtag1-dev 
      - libtag1v5
      - libtag-extras-dev
      - libsdl-sound1.2
      - libtag1v5
      - python3-webview

OK. This is how I fixed it.

Using stage-packages does add python libs. But it is not accessible to python interpreter. It’s possible to tell python where to find libs, thanks to PYTHONPATH environment variable.

In section app > someappname, add environment then add "PYTHONPATH":"$SNAP/usr/lib/python3/dist-packages"

like so:

    command: mycommand
      - audio-playback
      - x11
      - browser-support
      - desktop
      - desktop-legacy
      - home
      - media-hub
      - opengl
      - pulseaudio
      "PYTHONPATH": "$SNAP/usr/lib/python3/dist-packages/"#This is what I'm talking about

now you can install python dependencies as stage-packages