# Editor\_did\_init\_left\_buttons hook is not working?

**URL:** <https://forums.ankiweb.net/t/editor-did-init-left-buttons-hook-is-not-working/14703>\
**Category:** Add-ons\
**Created:** [November 5, 2021, 3:37pm UTC](https://forums.ankiweb.net/t/editor-did-init-left-buttons-hook-is-not-working/14703 "2021-11-05T15:37:28Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![caramel1995](https://avatars.discourse-cdn.com/v4/letter/c/6a8cbe/32.png) [@caramel1995](https://forums.ankiweb.net/u/caramel1995)\
**Post date:** [November 5, 2021, 3:37pm UTC](https://forums.ankiweb.net/t/editor-did-init-left-buttons-hook-is-not-working/14703/1 "2021-11-05T15:37:28Z")

</div>

I try to use a `gui_hooks` named `editor_did_init_left_buttons`. The code for the addon below will be triggered whenever we click the Add new card button.

```auto
from aqt import gui_hooks
from aqt.utils import showWarning

def button(btn, editor):
    showWarning(str(btn))
    showWarning(str(editor))

gui_hooks.editor_did_init_buttons.append(button)

```

The problem is, when I try to print out the content of the first parameter `btn`, all I got is an empty list.  
I search through the code to figure out where does the hook got triggered and I saw it’s in `aqt.editor`.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/2X/1/106485fb8bcf780fd341bf6e9799362fbf0631ce.png)

In the screenshot above, we can see the first argument that is passed to the hook is `lefttopbtns`.

But why the addon I wrote is returning an empty list?

 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/2X/a/ac1733270ecbf2f3577f079cf0d8cf08285ae08a.png)

---

<div class="post-metadata">

**Author:** ![abdo](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/abdo/32/654_2.png) [@abdo](https://forums.ankiweb.net/u/abdo)\
**Post date:** [November 5, 2021, 6:52pm UTC](https://forums.ankiweb.net/t/editor-did-init-left-buttons-hook-is-not-working/14703/2 "2021-11-05T18:52:55Z")

</div>

It seems the editor code in your screenshot is outdated. You can see here that `lefttopbtns` is an empty list now: [anki/editor.py at c9bd39c6a212dc5f4a2484da4a0690225bd6d923 · ankitects/anki · GitHub](https://github.com/ankitects/anki/blob/c9bd39c6a212dc5f4a2484da4a0690225bd6d923/qt/aqt/editor.py#L136)

This was changed in this commit: [Add RawButton and hook old python hooks up to it · ankitects/anki@920b740 · GitHub](https://github.com/ankitects/anki/commit/920b740c8fd1e857413ae310a0314d2a0ca32ab5)

---

<div class="post-metadata">

**Author:** ![caramel1995](https://avatars.discourse-cdn.com/v4/letter/c/6a8cbe/32.png) [@caramel1995](https://forums.ankiweb.net/u/caramel1995)\
**Post date:** [November 6, 2021, 2:51am UTC](https://forums.ankiweb.net/t/editor-did-init-left-buttons-hook-is-not-working/14703/3 "2021-11-06T02:51:21Z")

</div>

@abdo thanks for the insight.

Just saw the anki package in my machine is **2.3.7**.

I tried to upgrade it to **2.1.49** but I keep getting the error saying requirement not satisfied.

 ![image](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/2X/f/fde6cf1da10c9e1c19115f445c23d8df5d6872ec.png)

I am runnig **python 3.10** , **Windows 10 64-bit**.

---

<div class="post-metadata">

**Author:** ![abdo](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/abdo/32/654_2.png) [@abdo](https://forums.ankiweb.net/u/abdo)\
**Post date:** [November 6, 2021, 8:32am UTC](https://forums.ankiweb.net/t/editor-did-init-left-buttons-hook-is-not-working/14703/4 "2021-11-06T08:32:11Z")

</div>

I would suggest trying with Python 3.9, as 3.10 is not fully supported yet.
