Python kivy. Не отображаются виджеты в одном из окон

Ребята, я дико извиняюсь за лютый говнокод и за лишнюю пока не рабочею херню.Вообщем проблем в том, что после вызова функции add_delwid(), на 68 строчке, на ThirdWindow() не отображаются созданные виджеты. Вот py файл:

#import
from kivy.app import App
from kivy.uix.boxlayout import BoxLayout
from kivy.uix.anchorlayout import AnchorLayout
from kivy.uix.textinput import TextInput
from kivy.uix.button import Button
from kivy.uix.screenmanager import ScreenManager, Screen
from kivy.uix.popup import Popup
from kivy.uix.label import Label
from kivy.uix.gridlayout import GridLayout
from database import DataBase
#главный экран
class Mainwindow(Screen):
    #атирбуты класса
    bl = BoxLayout(orientation='vertical')
    global DB
    DB = {}
    global x
    x = ''
    #создание popup окна
    def create_popup(self):
        global popupWindow
        popupWindow = popup()
        popupWindow.open()
    #создание BoxLayout(а) на главном экране
        if x == '':
            self.add_widget(self.bl)
    #создание кнопки 
    def crb(self):
        DB[x] = y
        print(DB)
        popupWindow.dismiss()
        self.bl.add_widget(Button(text = x, size_hint = (.8, .5), on_release = lambda x: print(id(self), set_screen('second'))))
#popup окна
class popup(Popup):
    def ccrb(self):
        global x
        x = self.textinput.text
        if not x == '':
            Mainwindow().crb()
class popupwin(Popup):
#атрибуты и название метода одинаковые потому что по какой-то причине popupwin унаследовался от popup а не от Popup
    def ccrb(self):
        global y
        y = self.textinput.text
        print(DataBase().getsp(y))
        if not y == '':
            SecondWindow().crl()
#экран-список
class SecondWindow(Screen):
#атрибуты класса
    gl = GridLayout(cols = 2, size_hint = (.85, .8))
    global y
    y = ''
#создание popup окна на 2 экране
    def create_popup2(self):
        global popupWin
        popupWin = popupwin()
        popupWin.open()
    #создание Gridlayout(а) на 2 экране
        if y == '':
            self.add_widget(self.gl)
#очистка виджетов
    def delwid(self):
        #вызов функции сооздания label на третем экране
        self.gl.remove_widget(self.btn)
        self.gl.remove_widget(self.lbl)
        ThirdWindow().add_delwid()
#создание Label на 2 экране
    def crl(self):
        popupWin.dismiss()
        self.lbl = Label(text = y, size_hint = (1, .1))
        self.btn = Button(text = 'Купил(а)', size_hint = (1, .1), on_release= lambda x: self.delwid())
        self.gl.add_widget(self.lbl)
        self.gl.add_widget(self.btn)

class ThirdWindow(Screen):
    gl = GridLayout(cols = 2, size_hint = (.85, .8))
    def add_delwid(self):
        self.gl.add_widget(Button(text = 'отмена'))
        self.gl.add_widget(Label(text = y))
        self.add_widget(self.gl)
            
db = DataBase()
def getid():
    r = id(u)
    print(r)
#перемещение между экранами
sm = ScreenManager()
def set_screen(name_screen):
    sm.current = name_screen
#фундамент
class pageApp(App):
    def build(self):
        sm.add_widget(Mainwindow(name='main'))
        sm.add_widget(SecondWindow(name='second'))
        sm.add_widget(ThirdWindow(name='third'))
        return sm

if __name__ == '__main__':
    pageApp().run()

Вот kv файл:

<Mainwindow>:
    AnchorLayout:
        anchor_x: 'right'
        anchor_y: 'bottom'
        Button:
            size_hint: 0.15, 0.15
            text:'+'
            on_release:
                root.create_popup()

<popup>:
    title: 'Введите название списка:'
    size_hint: 0.6, 0.3
    textinput: textinput
    BoxLayout:
        orientation: 'vertical'
        TextInput:
            id: textinput
            multiline: False
        Button:
            text: 'OK'
            on_release:
                root.ccrb()
<popupwin>
    title: 'Введите название продукта:'
    size_hint: 0.6, 0.3

        
<SecondWindow>:
    AnchorLayout:
        anchor_x: 'center'
        anchor_y: 'top'
        BoxLayout:
            size_hint: 1, 0.2
            AnchorLayout:
                anchor_x: 'left'
                anchor_y: 'top'
                Button:
                    text:'<'
                    on_release:
                        app.root.current = 'main'
            AnchorLayout:
                anchor_x: 'right'
                anchor_y: 'top'
                Button:
                    text:'куплено'
                    on_release:
                        app.root.current = 'third'
    AnchorLayout:
        anchor_x: 'right'
        anchor_y: 'bottom'
        Button:
            size_hint: 0.15, 0.15
            text:'+'
            on_release:
                root.create_popup2()
<ThirdWindow>:
    AnchorLayout:
        anchor_x: 'center'
        anchor_y: 'top'
        BoxLayout:
            size_hint: 1, 0.2
            AnchorLayout:
                anchor_x: 'left'
                anchor_y: 'top'
                Button:
                    text:'<'
                    on_release:
                        app.root.current = 'second'
            AnchorLayout:
                anchor_x: 'right'
                anchor_y: 'top'
                Button:
                    text:'меню'
                    on_release:
                        app.root.current = 'main'

Ответы (0 шт):