I'm sure you can code this using OBD11 or Carista.
Enable Ability to lock car with Engine running
Description: By Default Q7 (4M) cars can't be locked via the lock button on the keyfob or the button on the door (if you have convenience key) if the engine is running. This change enables the car to be locked while the engine is running. This is useful to say, for example warm the car up but keep it locked on your driveway.
Notes: If you having folding mirrors, they do not retract once you lock the car.
Usage: Once configured start car engine, get out car and lock. Engine will remain running.
Risk: Low.
Coding:
Module 46 - Central Convenience
Coding
Long Coding
Long Coding Helper
Byte 9
Tick Bit 7
Exit
Do It
ODBEleven Coding:
Module 46 Control Module "Comfort System"
Coding
Find "central_locking_system_lock_unlock_at_engine_runni ng"
Value is set to "Not Active"
Change Value to "Active"
Apply