Two Arduinos and juggling with com port switching on uploading the code

I have two Arduinos connected to com16 and com17. The on on com16 has a program called "receiver" and the other in com17 "sender".

When I want to upload a "receiver" program I select "Tools"->"Port"->"com17" and upload it.

When I want to upload a "sender" program I select "Tools"->"Port"->"com16" and up it goes too.

After having uploaded both I then go back to "receiver" an change some code and want to upload it again. But now the port setting in workspace window of "receiver" has change to com16.

Allthougt I have two separate Arduino workspace window they appear to share the port setting. Ie. which ever posrt setting was used last will go to all Arduino workspaces.
I would like the workspace window remember what their respective port setting were.

Any tips on how to avoid this.

Use two computers.

I use the Geany text editor and I have written a short Python program to compile and upload using the command-line IDE.

At the top of my programs I have a few lines of comments like the following which define the board and the port. So when I click Arduino Build in Geany the Python program knows what to do.

// python-build-start
// action, verify
// board, arduino:avr:uno
// port, /dev/ttyACM0
// ide, 1.5.6-r2
// python-build-end

...R

You can accomplish this by creating two instances of the Arduino IDE. If you start the Arduino IDE and then open multiple windows via any of the options in the File window (New, Open, Sketchbook, etc.) you will experience the behavior you described. However, if you start the Arduino IDE multiple times and then open one sketch from each instance, or open each sketch by double clicking the sketch file then each instance of the IDE and any windows created via that instance will not affect the other instance and its windows. Each instance will still affect all windows created by that instance.