In Part 4 I created a separate C# project and imported it. Things were working fine except for Intellisense was not available. Here is a screenshot showing the simplified code and Intellisense *not” happening after I type import VisUtil and type “VisUtil.py”

image

What is especially confusing is that it *does work* with the Interactive Shell…

image

image

Notice that I didn’t construct the path using __file__. That is simply because __file__ is not available in an interactive session because there is no file associated with an interactive session.

For reference, notice that VisUtil is nowhere in the Interactive session’s, sys.path

image

 

GETTING IT TO WORK

Unfortunately, the only way I have been able to get Intellisense for referenced C# projects is to modify the python project’s Search Path.

image

Under the project node, right-click on Search Path and select Add Search Path.

image

 

Navigate to the path holding the dll and click Select Folder.

image

And now the path appears in the project. (Notice that while it may be SHOWN as a relative path, it is really an absolute path. So if you relocate the project on disk it is still pointing to the old location. )

image

 

So instead of clr.AddReferenceToFileAndPath we will simply use clr.AddReferenceToFile. Once I made the change, I simply rebuilt the project and Intellisense kicked in again as shown below.

image