How do I use pyatspi in a snapcraft app?

I am trying to add python3-pyatspi to my python snap. However, when I try to import pyatspi I keep getting the error:

Namespace Atspi not available

I don’t get that error when I run the python code straight in the Terminal in Ubuntu. There, it works fine.

My own code never directly references the Atspi namespace, so I assume pyatspi does. What I was originally doing was this in my YAML:

parts:
    myapp:
        plugin: python
        python-version: python3
        source: .
        stage-packages:
            - python3-pyatspi
        requirements:
            - /root/project/requirements.txt

And then this in my pthyon:

import pyatspi

And that was giving me the error. Since I couldn’t find any clear direction via Google, I tried throwing all kinds of things at it. I added some things to the YAML, not really knowing if I should:

parts:
    myapp:
        plugin: python
        python-version: python3
        source: .
        stage-packages:
            - at-spi2-core
            - gir1.2-atspi-2.0
            - python3-pyatspi
        requirements:
            - /root/project/requirements.txt

And I added a gi import to the python code, because it seemed like some code samples I found online did that:

import gi
gi.require_version('Atspi', '2.0')
import pyatspi

But none of that made any difference. Any suggestions? I’d really appreciate it!