Hi, another newbie question

I have a lua script that reads a file and searches for hw addresses and if they are found, a dummy switch is turned on. When I connect a device, the file includes a hw address, otherwise the file is empty. My script works the way I want when manually run via another dummy switch that kicks the script on.
Is it possible to make script run "automatically" without a dummy switch?