Two things you should consider here, I strongly recommend you take a close look at inheritance in python cause that is exactly what you are looking for. Always remember to stick to conventional naming patterns, hence your classes should be capitalized
class Write:
c = 0
def do_num(self):
b = read.get_num()
self.c = 10
return b
class Read:
a = 0
c = Write.c
def get_num():
a = 6
return a
This will not work because on every turn you will be trying to reference a non existent class, meaning that what you have in your code, when you create class Write
you reference the Read
class which has not be cretaed yet and if you switch it up you have the exact same problem.
With that said i believe what would be a better fit for what you are trying to accomplish here would be using class attributes not class variables
class Book:
def __init__(self, a, c):
self.c = c
self.a = a
def do_num(self):
#some code
def do_num(self):
#some code
write = Book(0, 10) #a=0 and c=10
read = Book(10, 0) #a=10 and c=0
with this you can have various instances and variations of a and c without getting tangled in a web of inheritance needlessly. And since you are trying to work with the same variables and methods in both classes, there is no reason not to make it one class and use instances of that class instead