Here is Apple’s definitive compatibility list for Apple Pencil and iPad:
Apple Pencil compatibility - Apple Support
iPads that support Apple Pencil will support either the first or second generation Pencil - but not both.
The first and second generation Pencil use an entirely different pairing and charging interface.
The second generation Pencil can only be used with iPad models that have the magnetic/inductive dock that is exclusively designed for the Pencil. Pairing and charging is controlled via the iPad magnetic dock.
The first generation Apple Pencil uses the physical Lightning port of the Pencil and host iPad for both pairing and charging the first generation Pencil. The first generation Pencil can also be charged using an inline charging adapter and the iPad’s Power Adapter. This pencil can only be used with compatible iPad models that have a Lightning connector; with the sole exception of the new iPad10, requiring a special adapter, iPad models that feature a USB-C port lack any means by which to pair with a first generation Pencil.
In summary, the Apple Pencil models are not interchangeable - and can only be used with the iPad that has appropriate internal hardware.