Python code navigation?
Completed
I am writing some python code to support a swagger-generated (python flask) server using IntelliJ 2018.3.2 on Ubuntu. When I try to Ctrl-click my modules or methods, IntelliJ will not navigate to them - I get a 'Cannot find declaration' error tooltip. However, I know the code is parsing correctly (syntax highlighting is fine, PEP formatting rules are applied, and auto-completion for built-in methods seems to work fine). So is there some reason that IntelliJ can't find my other modules (located in the same directory)?
Please sign in to leave a comment.
Thanks!
You should mark src directory as Sources (right click the directory in project view --> Mark Directory as --> Sources Root) when importing something that isn't located on the project level.
Another option is to set path to the module when importing, like:
import src.utils
Hi,
Does it happen with just one particular module or all of them?
Please try File | Invalidate Caches / Restart... . Has it helped?
I tried that, and it still does not address the issue.
Would it be possible to provide a screenshot showing the problem and another one with your Project Structure (Settings | Project | Project Structure)?
The module it is having issues finding is in the same directory as the caller, and the code runs fine.
Thank you, Sergey, that worked great!