That button or lever is commonly called the m / a switch and is how you manually stop down the lens diaphragm to preview the depth of field effect you will get at a particular working lens aperture. This switch is most commonly found on lenses of the older thread mount system used by a wide variety of manufacturers in the 1960s, 1970s, and into the very early 1980s. Most of these lenses are in what we called the m42 mount, or the universal thread mount or commonly called the Pentax screw mount. m42 is actually the correct name for this lens mount, and this type of lens has been made by a wide variety of manufacturers in Japan and in Europe.
What camera do you have? The necessary way to use the switch would be different if you have say an older Pentax or Ricoh, or are using the lens on a new modern mirrorless that does not have the required mechanism to close down the lens from viewing to working aperture.
You state that you recently got into film photography so I assume that you have a camera that has the mechanism required to automatically close down the lens diaphragm from viewing aperture, or wide open as it is called to working or taking aperture, but assumptions can often be wrong.