You can run a command on one channel from another channel.
Several IRC commands will accept a channel specification, so you can run the command on any channel no matter what window is presently active. For example you can run the following commands on the #politics channel while you are in the #chat channel.
In the same way, you don’t have to have a channel window activated to send messages to a user on another channel. You can /msg a user on any channel because each nickname is unique on the whole network.