# Mycroft skill doesn't work

**URL:** <https://community.openconversational.ai/t/mycroft-skill-doesnt-work/10898>\
**Category:** Feedback / Support\
**Created:** [June 14, 2021, 6:44pm UTC](https://community.openconversational.ai/t/mycroft-skill-doesnt-work/10898 "2021-06-14T18:44:38Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![miriana](https://community.openconversational.ai/letter_avatar_proxy/v4/letter/m/7ea924/32.png) [@miriana](https://community.openconversational.ai/u/miriana)\
**Post date:** [June 14, 2021, 6:44pm UTC](https://community.openconversational.ai/t/mycroft-skill-doesnt-work/10898/1 "2021-06-14T18:44:38Z")

</div>

Hello everyone, I tried building a new skill on Mycroft, but it doesn’t work. Can anyone help me?  
This is the skill:

> from mycroft import MycroftSkill, intent\_file\_handler  
> import os
> 
> class Lightmgmt(MycroftSkill):  
> def **init** (self):  
> MycroftSkill. **init** (self)
> 
> ```auto
> @intent_file_handler('turn.on.intent')
> def turn_on(self, message):
> 
> self.speak_dialog("light_on")
> 
> ```
> 
> def create\_skill():  
> return Lightmgmt()

In the **local** folder I have:  
**light\_on.dialog** that contains:  
“accendo la luce  
la luca è accesa”

and **turn.on.intent** that contains:  
“accendi la lampada  
accendi”

---

<div class="post-metadata">

**Author:** ![ChanceNCounter](https://community.openconversational.ai/user_avatar/community.openconversational.ai/chancencounter/32/1965_2.png) [@ChanceNCounter](https://community.openconversational.ai/u/ChanceNCounter)\
**Post date:** [June 14, 2021, 7:04pm UTC](https://community.openconversational.ai/t/mycroft-skill-doesnt-work/10898/2 "2021-06-14T19:04:03Z")

</div>

That should read

` __init__ (self)`

rather than `init(self)`

` __init__ ` is a method belonging to all objects which runs when the object is created. There are other methods kind of like that, with names that start and end in underscores, which are also called automagically under specific circumstances, but you don’t need to worry about those for now (or, possibly, ever.)

---

<div class="post-metadata">

**Author:** ![miriana](https://community.openconversational.ai/letter_avatar_proxy/v4/letter/m/7ea924/32.png) [@miriana](https://community.openconversational.ai/u/miriana)\
**Post date:** [June 14, 2021, 7:07pm UTC](https://community.openconversational.ai/t/mycroft-skill-doesnt-work/10898/3 "2021-06-14T19:07:15Z")

</div>

> [@ChanceNCounter](#):
>
> ` __init__ ` is a method belonging to all objects which runs when the object is created. There are other methods kind of like that, with names that start and end in underscores, which are also called automagically under specific circumstances, but you don’t need to worry about those for now (or, possibly, ever.)

I don’t know why but in my code there is the underscore!  
I think I didn’t transcribe well, sorry…  
Apart from that, do you know what problem can it be?

---

<div class="post-metadata">

**Author:** ![ChanceNCounter](https://community.openconversational.ai/user_avatar/community.openconversational.ai/chancencounter/32/1965_2.png) [@ChanceNCounter](https://community.openconversational.ai/u/ChanceNCounter)\
**Post date:** [June 14, 2021, 7:40pm UTC](https://community.openconversational.ai/t/mycroft-skill-doesnt-work/10898/4 "2021-06-14T19:40:37Z")

</div>

Well, might also be a transcription error, but that indentation isn’t right, either. Try encasing it in triple backticks

````python
    ```python
    <paste code here>
    ```

````

It might jump out at me after that =P otherwise, when you say it doesn’t work, how not? Where does it fail, and what does it say?

---

<div class="post-metadata">

**Author:** ![gez-mycroft](https://community.openconversational.ai/user_avatar/community.openconversational.ai/gez-mycroft/32/1937_2.png) [@gez-mycroft](https://community.openconversational.ai/u/gez-mycroft)\
**Post date:** [June 15, 2021, 5:27am UTC](https://community.openconversational.ai/t/mycroft-skill-doesnt-work/10898/5 "2021-06-15T05:27:14Z")

</div>

In your pasted text there are spaces and tabs - we generally stay away from that debate and either will work but it needs to be consistent. Python doesn’t handle a mixture of tabs and spaces.

It may also be an indentation issue, Python is picky about consistency there too.

This version of the Skill works fine given those two other files exist in `locale/en-us/`

```auto
from mycroft import MycroftSkill, intent_file_handler
import os

class Lightmgmt(MycroftSkill):
    def __init__ (self):
        MycroftSkill. __init__ (self)

    @intent_file_handler('turn.on.intent')
    def turn_on(self, message):
        self.speak_dialog("light_on")

def create_skill():
    return Lightmgmt()

```

Some other random notes:

- If you don’t need that ` __init__ ()` method it can be excluded.
- You can now use the shorter `intent_handler` decorator.

So this would make the Skill:

```auto
from mycroft import MycroftSkill, intent_handler

class Lightmgmt(MycroftSkill):

    @intent_handler('turn.on.intent')
    def turn_on(self, message):
        self.speak_dialog("light_on")

def create_skill():
    return Lightmgmt()

```
