I am working on an addon, for anki, which requires me to import a new deck using its python API. I found the function called test_apkg which seems to have parts which do that. I tried implementing that below, I am getting no errors, however the deck does not get imported. How do I make my testFunction() import a deck for anki?
from aqt import mwfrom aqt.utils import showInfo, qconnectfrom aqt.qt import *from anki.importing import *import osfrom anki.collection import Collection as aopen#from anki.pylib.tests.shared import getEmptyColfrom .shared import getEmptyColdef testFunction() -> None: file = "flashcards.apkg" col = getEmptyCol() apkg = r"path_to_file/flashcards.apkg" imp = AnkiPackageImporter(col, apkg) imp.run()# create a new menu item, "test"action = QAction("Import", mw)# set it to call testFunction when it's clickedqconnect(action.triggered, testFunction)# and add it to the tools menumw.form.menuTools.addAction(action)