How does Anki load add-ons in PyQt?

Hello I’m trying to create a plugin-based program similar to Anki. Can anyone point me to the files that does this logic? Thanks

Add-ons are just Python modules that Anki imports normally: anki/ at e33bed2a25983cd41830169327e46d1baf710564 · ankitects/anki · GitHub

1 Like

Sorry it took a while for me to research on what’s happening in the code.

So from what I understand, loading an add-on is simply importing a python module. Now this is easy to implement in a dev environment (i.e. cloning the repo and running python since the AddonManager can download the addon and load it by importing from the directory.

However, in the packaged/built setup (i.e. using py2exe or pyinstaller), dynamic imports cannot be used. So my question is how does anki work around this? Is there a way to build an app so that addons can still be usable?

Don’t dynamic imports work if you add the add-ons folder to sys.path like Anki does here? I can’t help with specifics about pyinstaller/py2exe/etc. as I never tried dynamic imports with these tools; @dae will have a better idea.

1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.