Intellisense doesn't work with packages ?

Apr 16, 2015 at 10:59 AM
Edited Apr 16, 2015 at 11:09 AM
Hello,
I'm using the latest version of Python tools, and VS 2013.
I have some problems that the intellisense doesn't work with my packages :(
This is the structure of my working directory :
--WorkingFolder
  |--  __init__.py
  |-- file1.py
  |-- file2.py
  |-- python solution & python project files
  |-- package1 (folder)
    |-- __init__.py
    |-- package1_file1.py
    |-- package1_file2.py
In file1.py:
import package1 .package1_file1
it can build without error . But the intellisense doesn't work :( , it tell that package1:<unknown type> , so the code suggestion failed.

If in file1.py, I use :
import WorkingFolder.package1.package1_file1
the intellisense can work :( but can not build success ( both VS and run from command line ).

if in package1_file1.py :
import package1_file2.py
the intellisense also doesn't work :(

The second problem is I could not found anyway to add a new (empty) package to project . I must do it by add a empty folder, then add init.py. Is there any faster way to add a new package ?
Do anyone have experience on these problems? Help me please :(
Thank you so much !
Coordinator
Apr 16, 2015 at 6:37 PM
I think your problem is that you have __init__.py inside your WorkingFolder, making it a package. Is it really the expected behavior? If so, you may want to move the solution & project files one level up. Otherwise, just get rid of __init__.py.

As it is, you're basically making a relative import from within a package to another module in that package. The preferred syntax for that is explicit: from .package1 import package1_file1 (note the leading dot in "from"). See here for more details.