Get host revit version in pyrevit

Hello,

Trying to get the hosting revit session version in pyrevit without success.
On pyrevit docs they mention using this.

thank you for your help
J

from pyrevit import revit, DB, UI
from pyrevit import script
from pyrevit import forms

from pyrevit import HOST_APP

hostapp = _HostApplication(revit)
print hostapp.is_newer_than(2017)

This is the dynamo forum and not a PyRevit area therefore i would suggest you visit the pyrevit github page to ask for help/guidance on coding for Pyrevit.

1 Like

@Brendan_Cassidy is right about this being the wrong forum, but (for me) it is the top search result for “pyrevit get revit version”. This doc page for pyRevit shows several methods one can use for the host Revit version:

from pyrevit import HOST_APP
print(HOST_APP.is_newer_than(2017))
print(HOST_APP.is_older_than(2021))
print(HOST_APP.is_exactly(2020))
print(HOST_APP.version)
print(HOST_APP.subversion)
print(HOST_APP.version_name)