Import Class Error <fixed>

Hi.

Error:

I had this working, then I deleted the code and wrote it again and for some reason I get this error and I can’t import the class from another file.

I am new to Python and any help is very much appreciated, thank you.

Hi,

at the top, try: import Student

@gustavo_alves: It looks like you have an indentation error in Student.py, which we can’t see right now (and we wouldn’t be able to see indentation in a screenshot anyway).

Using a code fence (``` around the code block, or just select it and use the </> button a the top of the post editor), paste the code from Student.py you’re trying to run. Screenshots are hard to debug.

2 Likes

I get the same error.

Is ‘Student’ also the name of a class in the file ‘Student’?

I guess it was a typing error that resulted in the indentation error. It’s fixed now, thank you!

2 Likes

Yes, it was. The problem was with the indentation, it’s fixed, thanks!

Reference material for this common error message:

1 Like