PDF Form flattening/locking fields

Hello,
so for a title block I am trying to populate a PDF using Python. The most common and easiest way is to make fields that can be filled with acrobat and just fill them with python. So far so good, but no matter what i try i cant flatten the pdf or lock the fields that you cant see that they once where fields. Only solution that works for me is to print it using Microsoft print to PDF, but cant and dont want to use that cause I couldnt get it to work with python.
Does anybode know a Python intern solution? Maybe a labrary that functions just like a PDF printer or something?

I tried everythin the internet and even Chatgpt could suggest and also tried using PDF24 to make a image out of the pdf with the filled fields but no matter what the fields always dissappear