Part 1. Finding a File, Class or Symbol by Name
On this page:
- Preparing an example
- Navigate to file/class/symbol
Preparing an example
Add a Python file to your project and create some source code in it. For example:
Navigate to file/class/symbol
This is one of the most powerful PyCharm's navigation and search features that enables you to find actually any file, class or symbol by its name, and jump directly to it. This is how it's done.
Navigate to file
Press Ctrl+Shift+N, and type
d in the pop-up window that opens:
Navigate to class
Next, let's jump to a specific class. To achieve this goal, press Ctrl+N, and type,
* is a mask for any amount of any characters.)
The suggestion list shows all classes with the letter
o somewhere inside their names. Note
that each class is followed by its fully qualified path:
Foo from the
topLevelDir in the suggestion ist, and press
Enter. This time, the file opens with the caret at the class declaration:
Navigate to symbol
Next, let's jump to a certain member of a class. Press Ctrl+Shift+Alt+N, and type
From the suggestion list, select
o1 and press Enter. The file
deeplyBuriedFile.py opens at the method declaration:
Using additional controls
You might have noticed the additional controls in the pop-up windows.
First, you can show files, classes or symbols which reside outside of the current project. To show an extended suggestion list, select the check box Include non-project files/classes/symbols, or press the corresponding shortcut once more. Compare the suggestion list of classes within your project with the suggestion list that includes classes from the external libraries:
Next, click the pin () to show all the matching entries in a separate view of the Find tool window.
Finally, you can click the funnel icon to narrow down the suggestion list to show only the entries belonging to the specified file types:
This brief tutorial is over. You have mastered finding any file, class or symbol by its name, and navigating to it. In the next tutorial, we'll explore navigating to a class or symbol declaration and implementation, and using the gutter icons to jump to an overriding/implementing class or symbol.