Focus on object


I am writing a script in Python that will automate a number of parameters for all cameras in a scene. One of the things I want to do is to make all cameras focus on a selected object (like when you press F on the view panel). I’ve been looking around and also tried to echo all commands and still have no clue on how to do it. Anyone can help me on what commands to use?

EDIT. I’m sorry I was too anxious to ask here. The solution is to use the command viewFit.


I believe only one camera can be focus on an object at a point of time and not multiple camera can do it. Let’s see if we get more thoughts on it.