SimConnect script in Python

Trying to create a Python script for automating basic tasks in the cockpit, but it doesn’t do anything on the aircraft. Never used SDK before. MSFS 2024, FBW A32NX

from SimConnect import SimConnect, AircraftRequests

sm = SimConnect()
aq = AircraftRequests(sm, _time=2000)

aq.set("FLAPS HANDLE INDEX", 1)

Also tried

from SimConnect import *

sm = SimConnect()
aq = AircraftRequests(sm, _time=2000)
ae = AircraftEvents(sm)

def event():
    ae.find("FLAPS_1")

event()

All help and/or tips are appreciated

I’m not at home currently, but I recall there’s a Python wrapper available to do you want already.

I’ll try to find it and post the link as soon as I get home.

Edit - I had it in my links:

https://forums.flightsimulator.com/t/new-simple-simconnect-command-line-tool-with-search-get-set-watch-plus-autocomplete/

1 Like

Thank you! I got the events working in the meantime with a different syntax, but still no luck with changing vars.
As you see, I’m currently using Python SimConnect, if I switch to pysimconnect that you linked to, do I need to rewrite my whole script? Or does it use the same commands?
Edit: Found the sample file, it doesn’t use the same commands :smile: but it’s not that complicated either, will test if I can edit the vars with it.
Edit 2: Works now!! Thank you!!

1 Like

Glad you got it working. I haven’t worked with Simconnect and Python stuff for over a year. So I’m very rusty.