Importing from files issue

So I have an issue with importing on one script, but the other its working fine. I have to files one that has all the main code and then the other that handles everything that gets printed in a console.

I’ve had a definition script that handles color changes in the main.py, and it imported just fine over to my prints.py (where the prints are handled). But when I try to import my definition code called “printout” it has an issue importing it from prints.py to main.py

Repl link:
Resolved.

not working in main.py

from prints import outprint

working in prints.py

from main import colorChange

you forgot to close at the end of prints.py, like

""")
2 Likes

Hm, I fixed up some code errors but I seem to still getting the line seven error on main.py for some odd reason…

Read the error, you are importing printout from main and main from printout, this is circular and illegal in python. Make a third file and put the changeColor function in it and then import that file from main and printout

3 Likes

That seems to have fixed things, I appreciate the help! I try to get that in mind from now on.

1 Like

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.