Importing files from another extension in my extension code

I am trying to use a token(ITourHandler) from another extension(jupyterlab-tour) in my extension code to provide custom tour functionality, but I am not able to import the interface ITourHandler from the extension. Since jupyterlab-tour is not distributed as an npm package, how do I import the classes from that extension so that I can pass them as tokens in my code?

It’s on npm:

And the token is exported:

You do need to ensure that your extension:

  • in package.json
    • adds jupyterlab-tour to
      • #/dependencies
      • #/jupyterlab/sharedPackages
        "jupyterlab-tour": {
          "bundled": false,
          "singleton": true
        }
        
  • in pyproject.toml/setup.cfg/setup.py
    • adds jupyterlab_tour to install_requires

For your sanity, you’ll probably want to have at least a reasonable bottom pin, e.g. >=3.1.4, but potentially a top pin as well, e.g <4.