Originally Posted by Racheon
Doesn't exchanging weapons in 5th happen during the action phase? That means that you couldn't attack then switch weapons to do an off-hand attack, as the attack completes the action. I don't think it makes sense to be able to use a melee set action and then just switch to ranged to use the hand crossbow bonus action attack, unless the melee is a one handed weapon and the hand crossbow is being dual wielded in the off-hand.
There's no "action phase" in 5e. You can perform a free action (interact with - e.g., draw - an object) at any point in your turn, even between your main action and your bonus action. You can also split up movement however you want, even moving between the main action and bonus action (or between multiple attacks if you have Extra Attack).

The limitation here is how two-weapon fighting is worded: "When you take the Attack Action and Attack with a light melee weapon that you’re holding in one hand, you can use a Bonus Action to Attack with a different light melee weapon that you’re holding in the other hand." So yes you'd already need to be wielding the hand crossbow.

In addition, RAW you can't use a bonus action to fire a hand crossbow unless you take the Crossbow Expert feat, which has the same "that you're [already] holding" requirement. Two weapon fighting only applies of melee weapons.