udevadm info --attribute-walk --path=/sys/bus/path/to/device and see if there are attributes which allow you to distinguish the scanners, like a serial number or a product revision. This would allow you to distinguish the scanners regardless in which ports they are plugged.
If both scanners are identical, you can distinguish them by the USB port in which they are plugged using
KERNELS=="1-2.3" attribute, which refers to a device connected to USB bus 1, hub on port 2 and finally, port 3 of the said hub. The correct attribute values for your system can also be discovered with the
udevadm info command.
In both cases, you need to write an
udev rule as described here which either sets a certain name for each device (e.g.
NAME="ttyUSB1"), or creates symlinks with meaningful names (e.g.
SYMLINK+="/dev/scanner2") and make sure to use these names in your applications. Symlinks avoid issues when you have a third device which occupies one of the names you want to use.