Hi everyone. I am very new to pyrevit and I have what is probably a silly question. I managed to get buttons and tabs added in revit itself, but when I try to use the Autodesk.Revit.DB import, I get this error:
Import Autodesk.Revit.DB could not be resolved Pylance.
I am using VSCode. From some of the other subs, I think it is related to the interpreter, but I am not sure.
Check YouTube for Erik frits video on generating API stubs. In my experience pycharm is better than vs code, but still not ideal and I think it only works with Autodesk dll and can’t load pyrevit modules. He has videos showing how to set up in both
Here is pycharm video. Vs code should be easy to locate from there.
From description of your problem I’m assuming that you are trying to launch script within vscode. Unfortunately such approach is not supported by pyRevit. To run your code you should just save your scipt.py file and run it simply by clicking correlated button in your custom tab.