<aside> <img src="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/232fe76d-24e2-48a3-a042-fe083b28330a/ic_01_idea.png" alt="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/232fe76d-24e2-48a3-a042-fe083b28330a/ic_01_idea.png" width="40px" /> See Extension Bundles for informatiom about the bundle requirements


UI Extension Bundles can define a startup script in their root directory. This script gets executed once when pyRevit is first starting and on every reload. You can use these scripts to set up your development or user environment. The current implementation supports IronPython, CPython, C#, and VB.Net scripts.

See this page for more information

Anatomy of Extension Startup Script

<aside> <img src="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/541b8122-b6b3-4e5e-ae53-1118bb27c57c/alert.png" alt="https://s3-us-west-2.amazonaws.com/secure.notion-static.com/541b8122-b6b3-4e5e-ae53-1118bb27c57c/alert.png" width="40px" /> For setting up your own event handlers, its suggested to use Extension Hooks/


Here is an example script that sets up an event handler.

from pyrevit import HOST_APP, framework
from pyrevit import DB
from pyrevit import forms

# define event handler
def docopen_eventhandler(sender, args):
    forms.alert('Document Opened: {}'.format(args.PathName))

# add the event handler function
HOST_APP.app.DocumentOpening += \\