Tariffs work when you have multiple suppliers and only impose them on one. As long as there is someone else to buy from at a cheaper/normal price, it works.
They don’t work when when you tariff everything coming into the country (like Trump is doing). That’s just a tax on the consumer.