0

How to use Variable of outer instance from inner instance? I want access between two instance.

class paymanage_class():    #납입관리
    def __init__(self) -> None:
        self.inquiry_date_pay=datetime.today() + relativedelta(months=1) #<<<---This Variable
        self.paylist_dict={}       


    class pay_room():   #세대별 요금

        def __init__(self,page,room_num) -> None:
            self.page=page
            self.room_num=room_num


        
        def save(self): #<<<---I want use in here
            sql.connection().pay_update(self.room_num,"%s-%s-00"%(str(self.inquiry_date_pay.year),str(self.inquiry_date_pay.month).zfill(2)),self.entry_pay.get(),self.entry_date.get(),self.entry_method.get(),self.entry_memo.get())
            self.load()
        

JHL
  • 1
  • 1
  • pass the instance of the outer class to the inner class when instantiating it. – kindall May 18 '22 at 19:52
  • 2
    Does this answer your question? [How to access outer class from an inner class?](https://stackoverflow.com/questions/2024566/how-to-access-outer-class-from-an-inner-class) – Mateo Torres May 18 '22 at 19:52

0 Answers0