when notes are sharped or flat(not including the ones in that key, like fsharp in g, as noted by the key near the cleft) when changed to sharp or flat, on the next line, an inch down, are they still the same as the line of music above?

some sheet music it seems like they stay, other books it seems it reverts back to how the song started, only sharps or flats are those within the key signified in cleft like 4 sharpsin key of e

simple but vital question,
thank you

i will screw up music i play if i dont know this simple bit, a guitar player wanting to elevate his theory and keyboard skills and get an appreciation for the jazz and classical
an accidental remains so for the rest of the bar. in the bar after it appears, it's a natural note again. or something else, if the key makes it so.
Unlike the key signiture, a sharp or flat only applies to the line or space it is on, until the end of a bar.