I used your code 1:1 into my addActions.sqf ... what do you mean with "how are you calling" ?
Did i have to edit an other folder oder sqf file?
player action ["SWITCHWEAPON",player,player,-1];
waitUntil {currentWeapon player == "" or {primaryWeapon player == "" && handgunWeapon player == ""}};