If your two passports were the same type and issued by the same country, then the valid visa you have in your expired passport would work.
If your two passports are from different countries, the visa you have in your expired one will not be valid.
From the US State Department Visa FAQ (emphasis mine):
My old passport has already expired. My visa to travel to the United States is still valid but in my expired passport. Do I need to apply for a new visa with my new passport?
No. If your visa is still valid you can travel to the United States with your two passports, as long as the visa is valid, not damaged, and is the appropriate type of visa required for your principal purpose of travel. (Example: tourist visa, when your principal purpose of travel is tourism). Both passports (the valid and the expired one with the visa) should be from the same country and type (Example: both Uruguayan regular passports, both official passports, etc.).
When you arrive at the U.S. port-of-entry (POE, generally an airport or land border) the Customs and Border Protection Immigration Officer will check your visa in the old passport and if s/he decides to admit you into the United States they will stamp your new passport with an admission stamp along with the annotation "VIOPP" (visa in other passport). Do not try to remove the visa from your old passport and stick it into the new valid passport. If you do so, your visa will no longer be valid.
Credit:stackoverflow.com‘
5 Mar, 2024
5 Mar, 2024