There’s a reasonable chance the issue is in the context you have not provided. Please provide a minimum full example that we can use to try to reproduce the problem.
@dae Here is a full example that I tested in Anki to reproduce the error.
from aqt import mw
from aqt.utils import showInfo
from anki.collection import Collection
from aqt.operations import QueryOp
from aqt.qt import *
def batch_get_audio2(col: Collection):
return [0, 0]
def on_success(count: tuple) -> None:
showInfo(f"{count[0]} Meanings Added.\n {count[1]} not found.\n")
def batch_download() -> None:
op = QueryOp(
parent=mw,
op=lambda col: batch_get_audio2(col),
success=on_success,
)
# Show a progress window
op.with_progress(label="Fetching Audio").run_in_background()
# Add the Item to the Menu
action = QAction("Race Tester", mw)
# set it to call testFunction when it's clicked
qconnect(action.triggered, batch_download)
# and add it to the tools menu
mw.form.menuTools.addAction(action)