How to automate CSV file import through add-ons

Hello,

I’m using an update version of anki-connect to automate my card updating workflow. In order to do so I have added the below importFile action point.

    @util.api()
    def importFile(self, path):
        collection = self.collection()
        if collection is not None:
            try:
                self.startEditing()
                importer = TextImporter(collection, path)
                importer.openFile()
                importer.run()
            except:
                self.stopEditing()
                raise
            else:
                self.stopEditing()
                return True

        return False

But If I’m running this script, it imports the cards/notes in the default Deck. How can I specify the deck to import in ?

In importing.py it uses a DeckChooser, but I don’t know how to use it self.deck = aqt.deckchooser.DeckChooser(self.mw, self.frm.deckArea, label=False)

Yours sincerely,

Alexis