Mycroft Community Forum

Integrating custom modules in a custom skill

Hey all!

I’ve been working on expanding a custom skill I have for my Picroft that allows me to issue commands to my computer. Primarily for opening IDEs, CAD tools, terminal, etc. I would like to have the option to be able to specify which working directory to use when launching an application. I had the idea of using a parser expression grammar to extract the intended directory from the utterance in the intent handler. This would be a pretty easy way to cover a lot of ground, lexiconically speaking, in the parsing. I used tatsu to write the grammar and generate a python source file, and initially just included it and it’s relevant files in a directory (called peg) the main skill directory like:
mycroft-remote-computer
|-dialog
|- vocab
|- test
|- peg
| |- grammar.ebnf # the formulated grammar
| |- parser.py # the generated parser
| |- test.py # unit testing the grammar.ebnf
| |- generateParser.sh # for generating parser.py from grammar.ebnf
|- init.py
|- requirements.txt
|- settingsmeta.json

This did not work. Even after undoing everything in init.py that referenced the peg module, the skill was broken just having the peg directory. I suppose I could just put the PEG grammar in a separate repository and put it on the RPi, but that kind of defeats the point of having mycroft-msm take care of everything. So how do you integrate custom modules into your skill? Surely there’s a way other than uploading it to PyPi.

Skill repo: https://github.com/markditsworth/mycroft-remote-computer
Device: Picroft

There’s an example here referencing other python modules. .kodi_tools

Add an init.py to reference your modules.

Here…

2 Likes

Thanks! Though I just discovered the regex files option, so I might be able to get away with just using those. If not, thanks for the example!