Anki Forums

Is-it possible to download anki addon from an addon?

I found addons.download_addons but i’m not sure I can use it to download an addon from an other. ^^

def download_addons(
parent: QWidget,
mgr: AddonManager,
ids: list[int],
on_done: Callable[[list[DownloadLogEntry]], None],
client: HttpClient | None = None,
)
How to use this in an addon ? :thinking:

Try something like this:

from aqt.addons import download_addons

def on_done(info):
    print(info)

download_addons(mw, mw.addonManager, [2084557901], on_done)

See anki/addons.py at ebad6ad3793ece9f27aed13a870ae65a966a27f3 · ankitects/anki · GitHub for details about the info passed to on_done.

1 Like

Thanks for your answer , it helped a lot !


download
So it’s better but seem, I’m having an issue lol

from aqt import mw
from aqt.addons import download_addons

def on_done(info):
    print(info)

download_addons(mw, mw.addonManager, [2055492159], on_done)

Can’t do that at the start of anki, that was the problem.

Maybe you can work around this by using a hook like main_window_did_init

3 Likes

Thanks a lot !