maybe a stupid question, but I can't think of a logical pythonic way to solve my problem.
I have a application controlling some relays on a Raspberry Pi which I want to write a simple web interface for. I chose bottle for that.
Right now I have created a RelayController class which gets instantiated in a main.py file and takes care of initializing the hardware and switching the relays when I press the buttons. It also gets some configuration passed and everything works as expected.
Now I want a web interface that can display the state of the relays and add some buttons which will have the same function as the physical buttons.
My plan for creating the interface was to query a dict from the RelayController class and then render a template accordingly. That's the point where I'm stuck.
I can start the webserver in my main.py file with bottle.run(), but since the web app lives in another file I can't pass the RelayController instance to it and since the RelayController is created during runtime, I can't import it.
Is there any easy way to do that, am I missing something really simple? Also this will be an application that isn't used publicly or even by multiple users so I strive for a simple solution.
Thanks in advance.