[Solved] I’m not sure how to get this class to work


You must reference the class you have created to access the variable within it.

class Status(object):
    def __init__(self,piece,pawn_black1_status):
        self.piece=piece
        self.pawn_black1_status=pawn_black1_status
    def Status2(self,piece,pawn_black1_status):
        self.piece=piece
        self.pawn_black1_status=pawn_black1_status
        self.pawn_black1_status="dead"
        
pawn_black1_status="alive"
Pawn1b_status=Status("p1b",pawn_black1_status)
Pawn1b_status.Status2("p1b",pawn_black1_status)
print(Pawn1b_status.pawn_black1_status)

1

solved I’m not sure how to get this class to work