Fusion API and Scripts
Got a new add-in to share? Need something specialized to be scripted? Ask questions or share what you’ve discovered with the community.
Showing results for 
Show  only  | Search instead for 
Did you mean: 

Are type hints for the Python API available or if not are they planned?

Message 1 of 6
348 Views, 5 Replies

Are type hints for the Python API available or if not are they planned?

I observe that code suggestions in VS Code for Python are limited by the absence of type hints in the Fusion 360 interface libraries.  For the reader who wants background on type hints and suggestions, check out this link: typing — Support for type hints    


Enabling type hints makes mastering a new and complex API far easier, far safer, and frankly a lot more fun. Just hit "control-space" and you get the full list of functions and members that apply to that context and just have to pick one to have it pasted in without typos. Requiring an edit/compile/debug cycle to fix what ought to be a simple spell-check error is reminiscent of the 1970s when everyone used "vi" and was happy to spend months memorizing everything. I don't have the budget for that.

I can see the need to maintain backwards compatibility.  Python has it's significant issues here. That said, I believe this is so valuable that it would be worth maintaining a permanent version branch.

Does this already exist and I haven't found it yet? Are there plans to add this to the Python API for Fusion 360?

Message 2 of 6

Message 3 of 6

I should have been more specific. I am suggesting that the four files,,, all be modified -- by Autodesk -- to include "type hints".  I suspect that Autodesk either has this work on some Sprint backlog (or whatever) or has already announced it, or it was done years ago and I'm too new to know where to find out. Perhaps I could inspire the right person to help make it a reality?  As @kandennti demonstrated so well above we have the ability to use type hints and they are powerful. They ought be in those files.


On my Windows these four files are located in C:\Users\Tim\AppData\Roaming\Autodesk\Autodesk Fusion 360\API\Python\defs\adsk  and as mentioned above they are named,,,


The URL I gave before had a typo, my apology. It should have been  

Two concrete examples.  In in class "Application" we have this source code at (in my version) line 330:


    def userInterface(self):
We could instead have:
    def userInterface(self) -> UserInterface:
We could also add hints to the API for improving the UX experience not to mention type safety for arguments. Say in line 898

def pointContainment(self, point):
would be 
def pointContainment(self, Point: point)  -> PointContainment:

The type safety for composing arguments alone would be worth the trouble in my own opinion.

Is there a URL where future features a mentioned for the Fusion 360 Python API? That might end up being the only possible answer to my question.


Message 4 of 6

Thanks for the nice screen shots and explanations. I realize my question needed to be more specific and I tried to do that above.

Message 5 of 6

I think I found why type hints are missing from the 4 API files. This level of Python is a bit beyond what I was hoping to deal with. Any chance we could get Autodesk to release a version where the type hints are left in? Even if they might be confusing to some people?


Here is what I found.


VS Code debugging shows this file 

C:\Users\Tim\AppData\Roaming\Autodesk\Autodesk Fusion 360\API\Python\defs\adsk\


# This file is automatically generated for code intellisense only.
# It does not reflect the actual implementation.


def allToolbarPanels(self):


However the actual code that is executed is in C:\Users\Tim\AppData\Local\Autodesk\webdeploy\production\96174d2c4918a1a613b00371fd422e0f30e1d187\Api\Python\packages\adsk\ instead shows


def _get_allToolbarPanels(self) -> "adsk::core::Ptr< adsk::core::ToolbarPanelList >":


and later in the same file


UserInterface.allToolbarPanels = property(UserInterface._get_allToolbarPanels, doc="Gets all of the toolbar panels. This returns all of the panels\navailable, regardless of which workspace or product they're associated with.")



def _get_allToolbarPanels(self) -> "adsk::core::Ptr< adsk::core::ToolbarPanelList >":



I am pretty sure that if VS Code encountered someObj.getAllToolbarPanels(). (hit spacebar) it would know the result was a ToolbarPanelList and so on. This would make learning the API wonderful.  I'd like this to be wonderful.

Message 6 of 6

I know there are some fixes in this area coming.  I'm not sure if this specific issue is addressed but I agree that it is something that would be useful and hopefully it is coming.  Thanks for pointing it out.

Brian Ekins
Inventor and Fusion 360 API Expert

Can't find what you're looking for? Ask the community or share your knowledge.

Post to forums  

Autodesk DevCon in Munich May 28-29th

Autodesk Design & Make Report