Attach actors(Spotlight) to another actor (camera) in the sequencer?

how do i attach the spotlight to a camera so that it follows where the camera is going?

You can attach any actor to any other in Sequencer but this is one of those odd areas of Unreal.
Looks like they may have broken/changed somewhat in 4.27 - I’ll have to test.

Add your camera and spotlight to the sequence.
Spotlight - click on + Track button on right of spotlight
Select Attach from top of popup list
Note that before you do so you can select one of 4 attachment options at the bottom of Attach popup menu. These behaviors vary and not documented in any detail so you can leave a default of None for now.
Select your camera from the popup menu and the spotlight will move to its center. You’ll have to offset and angle the spotlight as desired.
Now whenever you move the camera the spotlight should move as well.
You’ll need to add a transform track to the spotlight if you want it to pan or deviate.

i actually tried that but it behaves weirdly, the spotlight goes in a weird path 500 units away which is not what i want. so i ended up putting both spotlight and camera in an actor and then animate the actor. which worked fine. i don’t know if its bug in unreal or i didn’t use it correctly.

Be aware it’s only attached during the valid frame range in sequencer and by default it’s easy to scrub before or after that and lose the connection.
When attachment acts odd try resetting the location for the object to 0, 0, 0 sicne that sometimes fixes it.
You can also try the different Attach modes. In 4.26 I could position the object relative to the object it was being attached to if I used POreserve current. That may have changed with 4.27
4.26 did have some bugs related to attaching so you may be hitting those.