0

This is my project:


In Pages.py After import file , work fine there are red line under file why ?


In .py After import file Locators.py and .py, and like photo Everything work fine but there are red line under file why ?

and this line:

  • What does it say when you hover over those red underlines? – AzyCrw4282 Mar 12 '20 at 15:37
  • -from Locators import Locators Unresolved reference 'Locators' , after click more action I see , Rename Reference or convert to 'import Locators'. -from TestData import TestData Unresolved reference 'TestData', after click more action I see ,Install Packages TestData and Rename Reference or convert to 'import Locators'. –  Mar 12 '20 at 16:22

1 Answers1

0

Try the following:

  1. check for __init__.py file in src folder
  2. add the src folder as a source root
  3. Then make sure to add additional sources to your PYTHONPATH
  4. in PyCharm menu select: File --> Invalidate Caches / Restart

Point 4 generally fixes the unresolved reference errors. If that doesn't work then see the answer here. It contains many solutions that you may try.

If nothing has worked, then you can just turn off the red underline by going to

File->Settings->Editor->Inspections

From there simply untick the relevant error.

A side note: It's always best to place your imports right at the top.

AzyCrw4282
  • 5,754
  • 3
  • 13
  • 25
  • if this answer helped solve your problem, please mark it as accepted by clicking the check mark next to the answer. see [here](https://meta.stackexchange.com/questions/5234/how-does-accepting-an-answer-work) for more information – AzyCrw4282 Mar 22 '20 at 03:37