No, scolding after the fact teaches a
Love My Puppy home training to hide rather than to hold it, since puppies don't connect punishment to an action from several minutes earlier. Catching the behavior in progress and redirecting calmly outside is far more effective.