Genanki: Can not get the card order right

I generated a deck using GitHub - kerrickstaley/genanki: A Python 3 library for generating Anki decks
The model I’m using is following:

anki_model = genanki.Model(
    1799440363,
    'Georgian top 1000 words',
    fields=[
        {'name': '_idx'},
        {'name': 'Georgian'},
        {'name': 'Russian'},
        {'name': 'Translit'},
        {'name': 'Usage'},
        {'name': 'UsageRu'},
    ],
    templates=[
        {
            'name': 'Ka-Ru',
            'qfmt': '{{Georgian}}',
            'afmt': '{{Georgian}}<hr id="answer"/>{{Russian}}<br/><i>{{Translit}}</i><br/><div class="usage">{{Usage}}</div>',
        },
        {
            'name': 'Ru-Ka',
            'qfmt': '{{Russian}}<br/><br/><div class="usage">{{UsageRu}}</div>',
            'afmt': '{{Russian}}<hr id="answer"/>{{Georgian}}<br/><i>{{Translit}}</i><br/><br/><div class="usage">{{Usage}}</div>',
        },
    ],
    sort_field_index=0,
)

What I want is for Anki to show me both Ka-Ru and Ru-Ka interleaved. Instead, Anki shows only Ka-Ru. I tried to create a deck with only 5 notes, and Anki showed 5 cards Ka-Ru and only then 5 cards Ru-Ka

I tried playing with all available options in Anki: different display order, sibling burying: nothing helps. Only setting New card order to “Random” makes Anki show both types of cards, but random order is not what I want

Deck created manually from Anki is displayed in correct (interleaved) order.

This behavior is the same on PC and Android

I understand that this is most likely a problem in python library that I use, but I can not figure out what this library does wrong, so I really hope someone can help me

I can’t tell you what that deck generator is doing, but I can talk to you about the order your New cards are being introduced.

Have you looked at what New queue # is being assigned to each card?

Generally, when you add a note that creates multiple cards, they are all given the same New queue #. Then, it’s simple to get what you want using your New card gather and sort orders. But if you add an additional card type to the note type later, those new cards can be given a different sequence of queue #s, making it hard to control how they are introduced.

I don’t see “queue #” anywhere in desktop version, i see Due (which is New #0 for all cards) and Position which is 0 for all

Well, I kinda solved the problem for me. In case anyone came here from search engine, here’s my hacky solution:

install GitHub - VaiTon/ankituls: A tool to import and export Anki decks in common formats

export your deck to .toml
import your deck from .toml

Yes, I should have been more specific, but you found it – the New # in the Due column. And that’s definitely the problem. If everything is assigned the same New-queue #, there’s no way for Anki to put the cards in any sensible order. Hopefully you’ll pass that along to the developer of that tool so they can fix it.

The simplest fix to this is to sort the cards in the order you want them (perhaps by “Creation”?), and use Reposition (start 0, step 1, boxes unchecked) to get them into an ordered queue. The sibling cards will stay partnered, and then you can get what you want with a New card gather of “Deck” or “Ascending,” a New card sort of “Order Gathered,” and sibling burying turned off.