Let's say I have a raspberry pi here and I want to write a Python script that turns on the light as soon as a i2c signal reaches the pi and some pin gets high. I do not want to use polling for this task, as it could slow down the process (I know just a bit but I'ts just bad practice and puts load on the CPU and so on, so I don't want to permacycle asking for the input state)
Is there any kind of server or callback function I could use to realize this with a python script? Which library could I use to reach such a behaviour?
First Ideas are enviromental variables/the i2c Interface in the Linux system that I could listen to constantly somehow and catch it to make it do what I want it to.
As I see it no need to use python but I don't see whole picture so I don't know if this will help You,
just regarding this part of question:
Complete documentation - this is the npm module documentation
My example of configuring node.js server