Set enviroment in pre-request script

Describe the bug
Cant choose an enviroment for a specific request in the pre-request script section.

To Reproduce
Script in pre-request script section: e.g. postman.enviroment.set(‘Production’)

Expected behavior
The request should use the Production enviroment variables

Hi @mgh-sanistaal,

Welcome to the Postman community ! You can only link an environment to one or multiple collections and you cannot link a single request to a particular environment.
Have a look at the following link to learn more about collections:
https://learning.getpostman.com/docs/postman/collections/intro_to_collections/
With regards to the script to set the environment variable, I would take a look at the right side pane of Postman as shown in the attached image where you can view several code snippets including the one to set an environment variable:

I know you said “set environment” but just incase you’re wanting to “set an environment variable” use the below:

pm.environment.set("Production")

Also, you spelt “environment” incorrectly every time in your post. I do this all the time :stuck_out_tongue: