No module found error : relative path

Getting error, ModuleNotFoundError: No module named ‘cat’
The file cat is in parent of the current file in which from is written.( as shown in the figure)

Please don’t post images of code. We don’t use Photoshop to write Python

code, and images make it difficult or impossible for some people to see

your code.

What I see in your post is this:

![image|690x367](upload://lzoqkk0wP9LFB0T3tzjpBnWyGx7.png)

which is not helpful.

Please post your code as text, correctly formatted.

Let’s start with the basics.

  • What OS are you using? Linux, Mac OS-X, Windows, something else?

  • What version of Python are you using?

  • What is the full pathname of your cat.py file?

  • What does sys.path say?

  • What is the line of code you are using to import cat?

We may have more questions when we have the answers to those.

ModuleNotFoundError almost always means you have either not installed

the library you want, or you have mistyped the file name, or you have an

issue with the search path for Python, or if you are using a package, an

issue with relative and absolute paths.