This is the first time I’ve seen you say this, and even using the site search I can’t find any instance where you’ve expressed this as the reason behind your complaint, but I’ve seen you talk a half-dozen times about how you don’t like setting it every time you personally run your programs.
I was giving you a reasonable solution to the specific problem you’ve been expressing. You ignored my replies rather than clarifying why you wanted it both in this thread and in another one last year where I gave you the same advice.
If you want to do things in code, you could provide a bootstrap script that will set up the environment variable for the user before running your program. This is a very common. A few examples: