We can obtain a magnetic field due to a straight, long wire using Ampere's law by mentioning the current flowing in the wire, without emphasising on the source of the current in the wire. To apply Ampere's circuital law, we need to have a constant current flowing in the wire, irrespective of its source.