Python – Import file inside folder – No module found

  python, python-import

Here is my file structure:

Helpers folder contains 2 files – and The TextHelper file contains methods that are used by DoSomething. The methods in TextHelper use the constants in the MyConstants file. The DoSomething file does not use the constants directly. Here are the import statements:

from Helpers import TextHelper

import MyConstants

Here is the entire file

some_constant_1 = ""
some_constant_2 = 20

When I run DoSomething file, I get error:

Traceback (most recent call last):
  File "C:<path>DoSomething .py", line 10, in <module>
    from Helpers import TextHelper
  File "C:<path>", line 5, in <module>
    import MyConstants
ModuleNotFoundError: No module named 'MyConstants'

What am I doing wrong?

Source: Python Questions