I am working on a Kivy application. My app's design is shown in picture below:
I have two separate modules, MainLayout and Table. There is a label inside MainLayout named 'lblA' and a button inside Table named 'btnA'. Now I want to change lblA's text on btnA's click. But I am unable to create object of MainLayout in Table because MainLayout already has object of Table. Is there any solution to this problem ? I have spent a week with this issue but find no solution. Any help would be appreciable. Thanks.
The solution is listed in comment section and I am posting it as well. We can solve this using parent property of a module.
In my case, to change text of lblA on btnA click, Here is a simple code for btnA's click handler.
self.parent.ids.lblA.text = "I am changed from btnA(which is in Table module)"
Here, self.parent points to MainLayout, and inside that layout we have a label with id lblA.
For more help: proceed to this link: http://inclem.net/2019/06/20/kivy/widget_interactions_between_python_and_kv/