Add camera at random position through Python I am using Blender for the first time. Currently, I have a basic scene with a camera and some light sources present. What I would like to do is to add a second camera that is located at a random position in the same Z-plane as the first camera and is looking at the same XYZ-point. Maybe it would be possible to define a circle where the first camera is on and the second camera can freely choose a point. The first camera should not move. I would like to do this through Python, since I am generating multiple renders from this scene in a loop.

Any pointers to relevant documentation would be helpful, since I am not finding the correct resources to tackle this.
You can spawn cameras in a circle around your object, at the altitude of your main camera. Then add a "Track to" constraint to make the camera face the target object. Finally, set the camera to active. 

The constraint adds the benefit that it will follow the target object if it moves. If you dont have a target object you can create an empty in the scene.

How to randomly distribute points along a circle

import bpy
import math
import random
from mathutils import Vector

camera = bpy.data.objects['MainCamera']  # Make sure your first camera is named 'MainCamera'
target_object = bpy.data.objects['Cube']  # The camera will face this object. /!\ Naming

z = camera.location[2]
radius = Vector((camera.location[0], camera.location[1], 0)).length
angle = 2 * math.pi * random.random()

# Randomly place the camera on a circle around the object at the same height as the main camera
new_camera_pos = Vector((radius * math.cos(angle), radius * math.sin(angle), z))

bpy.ops.object.camera_add(enter_editmode=False, location=new_camera_pos)

# Add a new track to constraint and set it to track your object
track_to = bpy.context.object.constraints.new('TRACK_TO')
track_to.target = target_object
track_to.track_axis = 'TRACK_NEGATIVE_Z'
track_to.up_axis = 'UP_Y'

# Set the new camera as active
bpy.context.scene.camera = bpy.context.object


Result :