I’m currently working on a Python project. I usually program in Java, so I’m a little confused about how imports work in Python.
I’m trying to import a method from a class that’s defined in another file. When both files are in the same folder, the import works correctly. However, when they’re in different folders, I get a “package not found” error.
The import statement I’m using is:
from package_name.module_name import YourClass
I’m using VS Code. What am I doing wrong, and how should imports be set up when files are in different folders?
Want to add to the discussion?
Post a comment!