Wing Tips: Navigating Python Code with Wing (part 1 of 3)

Nov 14, 2019

Welcome to Wing Tips! Thanks for signing up to receive weekly tips on how to use Wing more effectively in your Python development.

In the this and the next two Wing Tips, we'll take a look at how Wing makes it easier to navigate and understand the structure of your Python code. Let's start with navigating to the point of definition of a symbol, finding all the uses of a symbol, and searching through all your project files.

Goto Definition

To get from any use of a symbol in Python code to its definition, use Goto Selected Symbol Defn in the Source menu. This jumps to the def, class, or the point at which a variable or attribute was first defined.

Another way to do this is to right-click on the symbol in the editor and select Goto Definition or Goto Definition in Other Split:


The menus also give the key bindings for the commands, or you can bind your own key to the command goto-selected-symbol-defn with the User Interface > Keyboard > Custom Key Bindings preference.

In some cases, jumping to a definition successfully depends on resolving imported modules correctly using the Python Path configured by Python. In most cases you will not need to add to this configuration, but doing so is possible with Project Properties from Wing's Project menu.

Navigation History

For this and all the other code navigation options, the history-back button at the top left of the editor may be used to return to the previous file or focus. Or move forward again in your navigation history with the history-forward button.

Find Uses

In Wing Pro only, Find Points of Use in the Source menu or the editor's right-click context menu finds all points of use of a symbol in Python code:


This search distinguishes between different but like-named symbols and will cover all project files and other files Wing finds on the configured Python Path. The tool's Options menu provides control over which files are searched and what types of matches are shown.

Search in Files

To find all occurrences of other strings in Python files or in project files of any type, use the Search in Files tool from the Tools menu with Look in set to Project Files and Filter set to the narrowest filter that includes the files that you wish to search:


This tool supports text matching, wildcard, and regular expression searching and automatically updates the search results as files change.

Searching on Project Files assumes that you have used Add Existing Directory in the Project menu to add your source code to your project. Typically the project should contain the code you are actively working on. Packages that your code uses can be left out of the project, unless you anticipate often wanting to search them with Search in Files.

That's it for now! We'll be back next week to continue this Wing Tips mini-series on navigating Python code with Wing.

As always, please don't hesitate to email if you run into problems or have any questions.

Share this article: