Light
, apparently a class in that library, has not been defined, or imported. In Python, whenever you reference any expression, such as Light(...)
on the right-hand-side of an assignment, it must already be present in the program (technically, in this case: the global namespace).
Not entirely your fault, I quickly glanced at the library you're using and in several places the examples use Light()
the same way you did, but without importing it first. This is.. not unreasonable in documentation, as you're expected to have some familiarity with Python, but they don't really tell you where to import it from.
Another quick glance at the source code suggests that either of these should work, and do the intended thing:
- Add:
from lifxlan import Light
near the top - Replace your import line with, simply,
import lifxlan
, and then uselifxlan.Light(...)
andlifxlan.LifxLAN()
where those names appear in the program.[1]
I strongly suggest taking a few hours to go through a Python tutorial, as you're going to quickly get into more advanced stuff as you try to get this working. It will help to have a framework of understanding before you do.
[1] Note: the line lan = LifxLAN()
probably isn't doing anything at all in this program, but I assume you'll be adding more code later that uses it.