tags:

views:

150

answers:

2

If I import a module in IDLE using:

import <module_name>
print <module_name>.__file__

how can I open it without going through the Menu->File->Open multiple-step procedure?

It would be nice to open it via a command that takes the path and outputs a separate editor like IDLE.

A: 

I don't think IDLE will do it for you, but if you use Wing, you can mouse over the name of the module, and do a <Ctrl>-<Left Click>, or open the right click context menu on the module name, and select "Goto definition." Simple. You don't even have to know the module's file location; you just have to have it on your PYTHONPATH.

Limitation: It doesn't work if you add it to your PYTHONPATH using sys.path.append(). It has to be on the path that exists when the file is opened, though you can configure that on a per-project or per-file basis within Wing.

jcdyer
+2  A: 
  • You can use ALT-M and write the name of the module in the popup box
  • You can use CTRL-O to open a file
lazy1