I have an issue which is I keep getting the error of NameError: name 'Class_Name' is not defined. Which I understand. The tricky part is that my code looks something like this:
class FirstClass():
second_class: SecondClass
def __init__(self):
"""SOME CODE HERE"""
class SecondClass(firsClass: FirstClass):
def __init__(self):
self.first_class = firstClass
So the problem is that no matter how I arrange the code, I will always have one above the other so it will always say that is not defined. How can I solve this?
------------------------SOLUTION----------------------------
I found the solution to this. If you use the import
from __future__ import annotations
It will read the file and you will be able to call the classes even if they are defined later in the code.