# Hook Scripts

virtualenvwrapper adds several hook points you can use to change your settings, shell environment, or other configuration values when creating, deleting, or moving between environments. They are either sourced (allowing them to modify your shell environment) or run as an external program at the appropriate trigger time.

## Environment Hooks

### postactivate

The $VIRTUAL_ENV/bin/postactivate script is sourced after the new environment is enabled.$VIRTUAL_ENV refers to the new environment at the time the script runs.

This example script for the PyMOTW environment changes the current working directory and the PATH variable to refer to the source tree containing the PyMOTW source.

pymotw_root=/Users/dhellmann/Documents/PyMOTW

The $WORKON_HOME/prermvirtualenv script is run as an external program before the environment is removed. The full path to the environment directory is passed as an argument to the script. ### postrmvirtualenv The$WORKON_HOME/postrmvirtualenv script is run as an external program after the environment is removed. The full path to the environment directory is passed as an argument to the script.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.