I am trying to code a program that calls on an established class from another python file called student. In the file student, a class called StudentInfo is established and init checks if the data is valid (eg. grade must be between 9-12, course code must fit format, etc.) I am trying to first take the user's inputs here.
import student
import transcript
def add_student(data):
dataDict = data
ID = str(len(dataDict) + 1)
student = StudentInfo(ID, input("Enter the student\'s last name: "), input("Enter the student\'s first name: "), input("Enter the student\'s grade: "), transcript.add_transcript(), input("Is the student registered: "))
return dataDict
When I try to define student as an object of class StudentInfo, it returns
NameError: name 'StudentInfo' is not defined.
I'm not sure what I'm doing wrong. I thought it might be the inputs but when I removed them it seemed to do the same thing. Please help and thanks in advance.
student.StudentInfo. Alternatively, change the import tofrom student import *(orfrom student import StudentInfoif that's all you need).