Hi @Kitamura and welcome, check this post to help you in your task, get the families from a directory or by category, edit them or background open them, check which one works for you, set the formula then save the families:
Whilst some of my nodes are old so have went into an unfound state, this is my script structure I use for batch setting of family formulae typically. Maybe it helps:
Hrm yeah I’d go query erfajo over on Orchid as he might have changed the levels of that node since I used it. Its one of the reasons I started building my own familydoc nodes in Python, just needed consistent behaviour.