Calling Class Function(s) of 2 Classes at Each Other

Viewed 72

I made two classes that would call each other's function before releasing a result but I'm having trouble making it work, is there a reason why I could call the function of the first class above but not the function of the one below?
Here is the program:

import random

HAND = []
DECK = ['Ojama Red', 'Ojama Blue','Ojama Yellow','Ojama Green','Ojama Black', 'Ojama Pink', 'Ojama Lime']

class A:

    def func1(self):
        random.shuffle(DECK)
        B.func3()
    def func2(self):
        c = DECK[0]
        if c in DECK:
            HAND.append(c)
            DECK.remove(c) 

class B:
    def func3(self): # STANDBY
        self.func4()
    def func4(self): # DRAW
        A.func2()
        self.func5()
    def func5(self): # MAIN PHASE 1
        print('\n', HAND)
        print('\n', DECK)

start_game = A()
start_game.func1()
1 Answers
import random

HAND = []
DECK = ['Ojama Red', 'Ojama Blue','Ojama Yellow','Ojama Green','Ojama Black', 'Ojama Pink', 'Ojama Lime']

class B:
    def func3(self):
        self.func4()
    def func4(self): # DRAW
        A.func2()
        self.func5()
    def func5(self): # MAIN PHASE 1
        print('\n', HAND)
        print('\n', DECK)

class A:
    def __init__(self):
        self.B = B()
    def func1(self, DECK):
        random.shuffle(DECK)
        self.B.func3()
    def func2(self):
        c = DECK[0]
        if c in DECK:
            HAND.append(c)
            DECK.remove(c) 



A = A()
A.func1(DECK)

This will give the output like.

['Ojama Lime']

['Ojama Yellow', 'Ojama Black', 'Ojama Blue', 'Ojama Pink', 'Ojama Red', 'Ojama Green']
> 
Related