Hi,
I’m trying to reference my library in the custom extension folder. But when run the code thru plugin button in Revit, error prompted and showed “ImportError: No module named lib”. Can anyone help with this? Thanks in advance.
Hi,
I’m trying to reference my library in the custom extension folder. But when run the code thru plugin button in Revit, error prompted and showed “ImportError: No module named lib”. Can anyone help with this? Thanks in advance.
You should reference to a file, not to a folder.
Create test_lib.py under lib folder. In test_lib.py create random class like
class Test_Class():
#some code in here
So basically in ur python scripts you use:
from test_lib import Test_Class
What @Tomasz said.
Pyrevit loads the lib directory as it was the site-package folder of a python environment, so you don’t have to specify it in the import
statement.
You can omit the __init__.py
file in the lib folder.