Python Modules
Shared Python available to every action, condition provider, event handler, recurring job and sidebar widget in your organization.
A Python module is named code that is injected into every Python execution in your organization. Define a function once and call it everywhere, with no import.
Use it for anything you would otherwise paste into several places: an API wrapper, shared formatting, a lookup table, the constants your team keeps re-typing.
Modules live under Settings → Python Modules.
Writing one
Define plain top-level functions:
TEAM_QUEUES = {
"web": "Web Team",
"warehouse": "Warehouse",
}
def team_label(team_key):
"""Human name for a team key."""
return TEAM_QUEUES.get(team_key, team_key)
def monday_request(query):
"""Call Monday's GraphQL API with the org's stored credentials."""
response = requests.post(
"https://api.monday.com/v2",
headers={"Authorization": get_secret("MONDAY_API_KEY")},
json={"query": query},
timeout=30,
)
response.raise_for_status()
return response.json()Then call them from anywhere:
def execute_action(context):
boards = monday_request("{ boards(limit: 5) { id name } }")
return {"team": team_label("web"), "boards": boards}Rules
- Module contents are injected, not imported. The name identifies the module in the dashboard; it does not namespace the functions.
- Modules load after the built-in helpers, so a function you define with the same name as a built-in wins.
- Inactive modules are not injected. Toggle a module off to take it out of circulation without deleting it.
A syntax error in an active module breaks every Python execution in your organization — actions, condition providers, event handlers, recurring jobs and sidebar widgets alike. Test your change against an action before you activate the module.
Where they apply
| Feature | Modules available |
|---|---|
| Custom actions | Yes |
| Condition providers | Yes |
| Event handlers | Yes |
| Recurring jobs | Yes |
| Sidebar widgets | Yes |
| Sidebar actions | Yes |