# Import menu access from add-on

**URL:** <https://forums.ankiweb.net/t/import-menu-access-from-add-on/21296>\
**Category:** Development\
**Created:** [July 8, 2022, 4:43am UTC](https://forums.ankiweb.net/t/import-menu-access-from-add-on/21296 "2022-07-08T04:43:13Z")\
**Posts on this page:** 8\
**Page:** 1

<div class="post-metadata">

**Author:** ![xmaill](https://avatars.discourse-cdn.com/v4/letter/x/9d8465/32.png) [@xmaill](https://forums.ankiweb.net/u/xmaill)\
**Post date:** [July 8, 2022, 4:43am UTC](https://forums.ankiweb.net/t/import-menu-access-from-add-on/21296/1 "2022-07-08T04:43:13Z")

</div>

Hello,

I am want to port some code I wrote. Currently it take a specific file format and create a deck out of it.

I want to change this and just import the file into Anki via the import function of the main menu. Is there some way to access this functionality via a hook or something like this ?

That way, I won’t need to do some extra things, just plain import a file and let the magic operates.

Thanx

---

<div class="post-metadata">

**Author:** ![BlackBeans](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/blackbeans/32/2283_2.png) [@BlackBeans](https://forums.ankiweb.net/u/BlackBeans)\
**Post date:** [July 8, 2022, 5:07am UTC](https://forums.ankiweb.net/t/import-menu-access-from-add-on/21296/2 "2022-07-08T05:07:44Z")

</div>

> [@xmaill](#):
>
> Is there some way to access this functionality via a hook or something like this ?

Anki doesn’t offer any such hook _itself_, but there is an add-on called _Anki Connect_ that provides such features.

---

<div class="post-metadata">

**Author:** ![xmaill](https://avatars.discourse-cdn.com/v4/letter/x/9d8465/32.png) [@xmaill](https://forums.ankiweb.net/u/xmaill)\
**Post date:** [July 8, 2022, 5:12am UTC](https://forums.ankiweb.net/t/import-menu-access-from-add-on/21296/3 "2022-07-08T05:12:48Z")

</div>

> [@BlackBeans](#):
>
> _Anki Connect_

Got it but does not mean to do what I want. Thus, I will have to build a whole machinery.  
Thnx

---

<div class="post-metadata">

**Author:** ![BlackBeans](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/blackbeans/32/2283_2.png) [@BlackBeans](https://forums.ankiweb.net/u/BlackBeans)\
**Post date:** [July 8, 2022, 5:14am UTC](https://forums.ankiweb.net/t/import-menu-access-from-add-on/21296/4 "2022-07-08T05:14:37Z")

</div>

You can also use ki, which may be a bit more convoluted to use programmatically, but still better than nothing.

---

<div class="post-metadata">

**Author:** ![xmaill](https://avatars.discourse-cdn.com/v4/letter/x/9d8465/32.png) [@xmaill](https://forums.ankiweb.net/u/xmaill)\
**Post date:** [July 8, 2022, 12:01pm UTC](https://forums.ankiweb.net/t/import-menu-access-from-add-on/21296/5 "2022-07-08T12:01:02Z")

</div>

Clearly, your solutions are not what I want. As said, I already wrote a GUI app to build a deck from my file. What I want is just get rid of any external frontend/tool and build (or modify) a deck directly into Anki.

An add-on is the perfect way and correct way to achieve this. I thought I could just build something around the “import” feature. You proved me wrong, so I will do it integrally from my Anki add-on I am planning to write.

---

<div class="post-metadata">

**Author:** ![oakkitten](https://sea2.discourse-cdn.com/flex002/user_avatar/forums.ankiweb.net/oakkitten/32/10465_2.png) [@oakkitten](https://forums.ankiweb.net/u/oakkitten)\
**Post date:** [July 8, 2022, 2:47pm UTC](https://forums.ankiweb.net/t/import-menu-access-from-add-on/21296/6 "2022-07-08T14:47:15Z")

</div>

I would suggest simply adding another menu option to, as in `File → Import from YAML` or something. You cold “manually” hook into the importing machinery—this is Python after all—but that’s fragile and can break with Anki update, and can break not only the add-on functionality but also Anki itself.

Also personally I just like it when add-ons add new menu items or buttons. Kinda weird when you install a thing and it appears nowhere.

---

<div class="post-metadata">

**Author:** ![xmaill](https://avatars.discourse-cdn.com/v4/letter/x/9d8465/32.png) [@xmaill](https://forums.ankiweb.net/u/xmaill)\
**Post date:** [July 8, 2022, 4:42pm UTC](https://forums.ankiweb.net/t/import-menu-access-from-add-on/21296/7 "2022-07-08T16:42:41Z")

</div>

Good idea. Just need to understand how to do this 🙂

---

<div class="post-metadata">

**Author:** ![system](https://us1.discourse-cdn.com/flex002/uploads/anki2/original/1X/8f1279ababc5879d54e4838989f606cfe55af8c7.jpeg) [@system](https://forums.ankiweb.net/u/system)\
**Post date:** [May 1, 2023, 3:15am UTC](https://forums.ankiweb.net/t/import-menu-access-from-add-on/21296/8 "2023-05-01T03:15:14Z")

</div>

Closed on May 1, 2023, 3:15am UTC


