Using Hooks to get the Family Name being loaded

Hi @THEfonz,
welcome to the forum!

Did you read the documentation about hook scripts?

Create Your First Hook
Anatomy od Hook Scripts
Extension hooks - list of all avaliable hooks

  • First, you should name your script doc-changed.py and drop the last line, pyrevit already registers the script for you
  • To get the event arguments, you need to from pyrevit import EXEC_PARAMS and then you can access them via EXEC_PARAMS.event_args; The same applies to the sender
  • Your imports are a bit messy, and you don’t really need them; you can greatly simplify the script like this:
from pyrevit import EXEC_PARAMS, forms

args = EXEC_PARAMS.event_args
sender = EXEC_PARAMS.event_sender
# Check all added elements
for added_element_id in args.GetAddedElementIds():
    # Get the element
    element = sender.GetElement(added_element_id)
    # Only proceed if the added element is a Family
    if isinstance(element, Family):
        # Get the name of the family
        family_name = element.Symbol.Family.Name
        # Display an alert
        forms.alert("Family instance placed: ",
            family_name,
            title="New Family Instance",
            footer="bimco Hooks"
        )

Note that this is not tested, so it may contain errors, but I hope it points you in the right direction!