Templating can be used to populate options without a separate script, if you use the right integration:
Integrations > Template > Select
Community Cookbook: Template Select Entities