Anki Plugin Not Executing Any Code on Startup

I am developing an Anki add-on and encountering a problem where none of my plugin’s code appears to run when Anki starts, even though the plugin is listed in the Anki Add-ons Manager. I have tried multiple debugging methods, including logging, print statements, and message popups, but nothing executes, and no errors appear in Anki’s debug console.

Problem Details

  1. Anki recognizes the add-on:
    ○ The add-on appears in Tools → Add-ons and is listed under its correct folder name.
    ○ The manifest.json is structured correctly.
    ○ The “package” name in manifest.json correctly matches the plugin folder name.

  2. However, no code from main.py executes:
    ○ I tried placing a simple print() statement in main.py, but it does not appear in Anki’s console or logs.
    ○ I attempted to use showInfo(“Hello World”) in main.py, but no pop-up appears.
    ○ I tested using multiple Anki hooks (profileLoaded, profile_did_open, profile_did_login), but still no execution.

  3. No error logs appear in Anki’s debug console:
    ○ I enabled Anki’s debug mode (-b), but no errors related to the add-on appear.
    ○ I checked addons.log and addon-errors.log, but they don’t exist, or they do not contain any errors about the plugin.
    ○ Even a minimal test plugin does not run any code at all.

Steps Taken to Diagnose the Issue

  1. Created a minimal test add-on (hello_world_guihook)
    ○ Used gui_hooks.profile_did_open.append(…) to trigger a pop-up message when Anki fully loads.
    ○ Expected behavior: A pop-up should appear when Anki finishes loading.
    ○ Result: Nothing happens—no pop-up, no logs, no execution.

  2. Checked Add-ons Folder Structure
    ○ Confirmed the plugin exists at:
    C:\Users<User>\AppData\Roaming\Anki2\addons21\hello_world_guihook
    ○ Confirmed manifest.json correctly references “package”: “hello_world_guihook”.

  3. Tested Multiple Execution Methods
    ○ Tried placing showInfo(“Test”) directly inside main.py → no effect.
    ○ Tried print(“Test”) at the top of main.py → does not appear in debug logs.
    ○ Tried various Anki hooks (profileLoaded, profile_did_open, startup) → no execution.

  4. Disabled all other add-ons & restarted Anki
    ○ Only kept hello_world_guihook enabled.
    ○ Still no execution.

The Core Issue: Anki Is Ignoring main.py Completely
• The plugin is recognized by Anki (it appears in the Add-ons Manager),
• But none of its Python code executes when Anki starts.
• No logs, no pop-ups, no errors—it’s as if main.py is not being executed at all.

Possible Causes (Seeking Expert Advice)

  1. Could this be an Anki environment issue?
    ○ Is there a setting or configuration that blocks certain add-ons from running?
    ○ Could this be related to a permissions issue in Windows?

  2. Does Anki have a known issue where add-ons are listed but do not execute?
    ○ Is there a bug that prevents main.py from being recognized in some cases?

(3. Is there another way to force execution of a plugin’s main.py?
○ Could we try manually executing an Anki add-on script from within the debug console?)

If anyone can help me with any of the above problems or can direct me,

  1. Verifying whether Anki is blocking the execution of main.py.
  2. Forcing an add-on to run manually (to see if it’s an Anki issue or a plugin issue).
  3. Other debugging methods to trace why an add-on is not running, even though it is recognized.

• Have you seen a similar issue where an Anki add-on appears in the list but doesn’t execute at all?
• Any ideas on diagnosing whether Anki itself is preventing the plugin from running?
• Could this be a problem with installing Anki? It should be noted that I uninstalled and reinstalled. But the problem remains as it was.
The version I have installed is the most updated and stable:
anki-25.02-windows-qt6
I’m mainly looking to understand the root of the problem and less for a specific solution that can specifically cancel/pause the problem.

Thank you very much in advance.

Do you have a __init__.py somewhere? This is the file that will be run when your add-on (or any Python module in general) is imported. If not, try renaming main.py to __init__.py or place import .main in __init__.py.

Hope this helps!

1 Like