__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.)
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/
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:
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()