A little bit of dumb stuff going on… You probably have the pylance extension downloaded. To get it to work correctly I had to go the pylance extension, click on it’s settings and then change the setting for the folder (I didn’t try workspace, so that may work) and add the folders in there. Another thing I tried that worked was disabling the pylance extension, then it worked… just not as well as it would have.
I have definitely not been paying attention to my emails…
One thing you can try is changing your import statement to be
from Autodesk.Revit import DB
and use DB.FilteredElementCollector() to see if that changes anything, this is also the “preferred” way to import rather than using *, as that can start clogging up what is in scope.
The other thing to try is run this script in pyrevit to generate new stubs. It looks like the stubs you have are structured differently than the ones I’m using, which may be causing some issues with the autocomplete. I believe I originally copied this code from the pyrevit dev extension if you prefer to find it there. This will also help with different versions of the API, you can generate the stubs per version and change the folders for whichever version you’re targeting/which version is giving you trouble.
"""Generate python stubs for this Revit version API."""
__title__ = 'Generate\nAPI Stubs'
__context__ = 'zero-doc'
from pyrevit.coreutils import assmutils
from pyrevit import labs
from pyrevit import forms
from pyrevit import script
logger = script.get_logger()
output = script.get_output()
ASSMS = [
dest_path = forms.pick_folder()
for assm_name in ASSMS:
assm = assmutils.find_loaded_asm(assm_name)
stubs_path = labs.PythonStubsBuilder.BuildAssemblyStubs(
print('Generated stubs for %s -> %s' % (assm_name, stubs_path))
except Exception as sgEx:
logger.error('Failed generating stubs for %s', assm_name)