IntelliSense isn't aware of my Django apps in PTVS 2.1

Apr 23, 2014 at 5:19 PM
I just installed PTVS 2.1 and I opened my Django project that was working with PTVS 2.0.

Now, IntelliSense does not recognize any of my apps. All local import statements have this error:
Unable to resolve "app.module". IntelliSense may be missing for this module.
However, it will not complain if I import "".

I deleted the project file and the solution and I tried importing the existing code, but I still have the same problem. How can I fix this?
Apr 23, 2014 at 5:33 PM
This is a change made to PTVS 2.1 to correctly resolve import statements. Previously, we were following the Python 2.5 and earlier rules that allowed implicit relative imports, whereas now we are using the absolute import rules that were introduced in Python 2.6 (with an option in 2.5). Since we don't support versions earlier than Python 2.5, we no longer support the old style of imports.

In short, all import statements need to start with a module that is in one of the sys.path paths, or in the same folder as the module doing the importing. For example, if your module is "mod1.mod2a.mod3a", you can import "mod1.mod2a.mod3b" or just "mod3b" or ".mod3b" (same result), but "mod1.mod2b" can only be imported with "mod1" at the start. (Previously, "mod3a" could import mod2b and it would be resolved, but now that has to be spelled import ..mod2b.)

Confusing? Yeah, I spent a lot of time sorting this out as I was making the change, and it's possible that I still got it wrong. Can you post a full directory listing of your project (dir /s/b is ideal) and specify exactly which modules are showing the error, what the import statements show, and which modules they should be getting? Also, does IntelliSense work for the modules with the warnings (typing from app.module import will show this really quickly)?

The solution may be as simple as removing your project\ file, but I do want to check whether you have a legitimate layout that we're handling incorrectly.

(Finally, if the warnings are always invalid and everything else works fine, you can turn them off through Tools\Options\Python Tools\General.)
Apr 23, 2014 at 6:21 PM
Edited Apr 23, 2014 at 6:25 PM
Removing "" solves the problems.

The project is pretty big, but it follows more or less the recommended directory structure (except for settings, which we broke down into more files). Another thing I did differently was saving the project file and the solution file outside the project folder.

In "project\app1\" there is an import "from app2.models import ...". If I type "from ...", app2 will not be in the auto complete list. The tooltip on the imported object says "<unknown_type>". If I type the first few letters anywhere after the import statement and then hit Ctrl-Space, the name will be shown in the list.
Apr 23, 2014 at 7:03 PM
I can see why you'd put that file there (I assume we're talking about the last one listed), but I don't know that it has any value. It certainly is the reason you need to include project in the full name, though if it is your working directory then Python will not require it.

I think right now PTVS will ignore search paths within the project when analyzing code (the start/working directory is just another search path for this purpose) which is why we find the full name even though Python itself won't require it. I would expect that if you ran "python project\ ..." instead of just "python" you'd get the import error that PTVS is warning about.

I'll create a work item to try and account for search paths when doing the analysis. There are no doubt other cases that are breaking if we are not handling this properly...
Apr 23, 2014 at 7:05 PM
This discussion has been copied to a work item. Click here to go to the work item and continue the discussion.
Dec 15, 2015 at 7:23 PM

I am having a very similar problem, though I am not using Django. I just have a bunch of python scripts that work just fine in Pycharm, and when run in python. I'd like to use Visual Studio python tools, as it looks to have better intellisense.

So I have the following structure. It's actually a collection py.test tests, with start script that initializes py.test:

project-dir (test setup script)
| |
| (Pytest module)
       |   (def class Config)  (def class ServicesClass) is the "startup script". It gets some config settings, and fires up pytest to run tests (My problems do not appear to be pytest related)
pytools is telling me that it cannot resolve references to class, or from and Normally main-script does not import the test scripts (, but I just tried it, and importing that seemed to work just fine.

Is there some reason why the ide would have trouble recognizing the helper classes? The classes have the same name as the file names, and as I said this all works fine in other IDEs.

Here are my import statements:
 from helpers.Config import Config
 from helpers.ServicesClass import ServicesClass
 from helpers.Config import Config
 from helpers.ServicesClass import ServicesClass

Dec 15, 2015 at 8:42 PM
Hi Sam.

Thanks for the feedback. PTVS is no longer hosted on CodePlex. We moved to GitHub ( a bit back and don't actively monitor CodePlex.

If you could please copy what you have here to an issue on GitHub we will be able to better help you out.

Dec 24, 2015 at 2:53 AM

I am new to python and am trying to configure VS to work with Blender ( When I use PTVS it debugs great, and I can see all of the subclasses when I mouse over. But it standard development mode, IntelliSense only recognized a fraction of the subclasses. Code checking and code complete don't is gone.

keep in mind that the entry point is always through Blender. The user scripts are called by Blender.

Is there a way to get this to work? A tutorial?

This is a very common request in Blender. If you'd help me out, I'd write tutorial in (VS has a substantial leg up for over Pycharm with PTVS and debuging of c++ code).