I am not 100% clear on the scenario. Did you execute the shot, and then, while the balls were in motion, your cue tip accidentally contacted another stationary ball on the table and sent it into a pocket e.g. independently of the original shot's balls in play?
My answer will assume that scenario.
The answer depends on a few factors. There are a few relevant rules to the scenario:
1.16.1 CUE BALL FOULS ONLY
When a referee is presiding over a match, it is a foul for a player to touch any ball (cue ball or object ball) with the cue, clothing, body, mechanical bridge or chalk, before, during or after a shot.
However, when a referee is not presiding over a game, it is not a foul to accidentally touch stationary balls located between the cue ball and the shooter while in the act of shooting. If such an accident occurs, the player should allow the Tournament Director to restore the object balls to their correct positions. If the player does not allow such a restoration, and a ball set in motion as a normal part of the shot touches such an unrestored ball, or passes partly into a region originally occupied by a disturbed ball, the shot is a foul. In short, if the accident has any effect on the outcome of the shot, it is a foul.
In any case, the Tournament Director must be called upon to restore the positions of the disturbed balls as soon as possible, but not during the shot. It is a foul to play another shot before the Tournament Director has restored any accidentally moved balls. At the non-shooting player's option, the disturbed balls will be left in their new positions. In this case, the balls are considered restored, and subsequent contact on them is not a foul. It is still a foul to make any contact with the cue ball whatsoever while it is in play, except for the normal tip-to-ball contact during a shot.
This one below states that the ball is respotted to as-close-as-possible to the original location.
Foul By Touching Balls (Regulation 3.21)
It is a foul to strike, touch, or in any way make contact with the cue ball in play or any object balls in play. This includes contact with anything, including the body, clothing, chalk, mechanical bridge, cue shaft, etc, except the cue tip that is attached to the cue shaft. This, and only this may contact the cue ball in the execution of a legal shot.
Whenever a referee is presiding over a billiard match, any object ball moved during a standard foul must be returned as closely as possible to its original position as judged by the referee. The incoming player does not have the option of restoration. For more details on this regulation, you can reference regulation 1.16.1 of the general rules.