Is it possible to use external modules with addons?

I’m writing an addon but whenever I try to use an external python module, I get an arror saying there is no such module installed (even tho there is). Does anyone know how to fix this issue?

I’m trying to use the module win10toast.

Also interested in this, I saw some addons like GitHub - AwesomeTTS/awesometts-anki-addon: AwesomeTTS text-to-speech add-on for Anki that use BeautifulSoup but I think that might be included with Anki?

Since there is no “install” step for addons (or is there?) I think you would only have access to the same packages Anki ships with, right?

If it’s a pure python module, you can put the module source in your add-on, then add its parent directory to path: sys.path.append()

If it’s a binary module, you can include the wheel files for each OS, then in your add-on detect the OS it’s running on and unzip the corresponding wheel, and then add the unzipped directory’s parent to path. (You may need to do some setup when installing though)

5 Likes