Python Script Controlled by HA

I have a custom LIFX scene that I developed in python before I started with Home Assistant.

Basically, it controls a series of color LIFX lights and tiles to achieve a desired dynamically changing effect.

Is there an way to start and stop this python code with Home Assistant? Basically I would want to be able to issue a start/stop or on/off and start or stop it.

I don’t think this will work with the python_script module, as it imports several other modules, and I understand that this is not possible with python_script.