My old bike had one battery in the frame and one on the rack. I properly fitted them, so I could lock them in place.
My current one has one rack battery either side of the frame. Again, properly fitted.
If you're going to use two batteries, it's really best to fit them properly - remember weight balance/distribution though, as my earlier one had handling issues.