After some investigation, I realized what was happening when I saw a line of code from a different file showing up in the error message, even though I was working on a different script. It turns out I had named my script code.py, which clashed with Python’s built-in code module. So, when Python tried to import the code module, it ended up importing my script by mistake, causing the error. The fix was simple: I just renamed my script to something other than code.py, and that resolved the issue.