Consider the following very simple Python project tree:

├── main.py
└── second.py


import second as s

def foo(arg):



def helloWorld():
    print("Hello World!")

My Jedi setup in ~/.emacs.d/init.el is the same as this file, but you can also see my exact setup here.

This project runs fine (python main.py outputs Hello World!) but running jedi:goto-definition on the helloWorld in arg.helloWorld() gives Definition not found.. However, if I were to change main.py directly to:

import second as s


Now jedi:goto-definition works and jumps to the def helloWorld() in second.py! So it looks to be a problem with Jedi not recognizing arg as coming from s? I am new to Python and maybe there is an intricacy that I am missing... but the bottom line is that I want Jedi to jump to the definition of helloWorld. How do I achieve this? Thanks for helping!

2 Answers 2


Works as expected for me:

$ pip show jedi
Name: jedi
Version: 0.10.0
Location: /usr/local/lib/python2.7/dist-packages

Ensure the latest version of Jedi:

pip install --upgrade jedi
  • Can you please provide your jedi config? Commented Feb 27, 2017 at 14:47
  • Ok, now my example is working for some reason... but doing jedi:goto-definition does not work for addDesignVariables on line 49 of this code. Why is that? Commented Feb 27, 2017 at 17:11

foo can be called with any arg, (arg should have a helloWorld method if you don't want to raise an exception, but it doesn't have to...), so it is impossible to know what arg could be in the function.

If you have for example:

import second as s

class Hello:
    def helloWorld(self):
        print('I can say hello too!')

def foo(arg):
    arg.helloWorld() # Where could helloWorld come from?

foo(s)         # from s?
foo(Hello())   # from Hello?
foo(2)         # doesn't even exist

So, jedi can't know...

  • Could you expand on your answer, please?
    – Dan
    Commented Feb 27, 2017 at 16:43

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.