1

My current folder structure is something like this:

folder/
   utils.py
   something.py
   etc.py

In something.py I do some imports:

from folder.etc import x
import utils.some_module

utils is a package installed from pip that unfortunately has the same name as one of my files inside folder. The code works normally but for some reason pylint gives me this error:

folder/something.py:11: [import-error(pylint), None] Unable to import 'utils.some_module'
folder/something.py:11: [no-name-in-module(pylint), None] No name 'some_module' in module 'utils'

If I change the file name from utils.py to something else the error disappears but I don't want to change it. The structure of package utils is as follow:

utils/
  __init__.py
  some_module

Does anyone have any idea how to fix this problem without changing the file name?

Thanks

daniel
  • 11
  • 1
  • This might help https://stackoverflow.com/questions/4383571/importing-files-from-different-folder – Bhaskar May 07 '20 at 07:46
  • Thanks bhaskar but python is able to execute my code without any problem, the problem is with pylint raising no-name-in-module even though the code works. – daniel May 07 '20 at 15:52

0 Answers0