Hi Sir.. Try using positive reinforcement. When your pet urinated outside, praise your pet, offer a treat/play with your pet. It would positively reinforce the idea of going outside & encourages them to continue. You could opt for training from kuddle...
If your pet is suddenly peeing in the house,and if you notice any other symptoms like dribbling of urine, blood in urine etc..it could also have some medical conditions like urinary tract infection, kidney issue..You could talk to a vet online through kuddle sir..