extracting data from PCM and WAV file in audacity using python

Need to Automate using python, use case:

  1. import PCM file as raw data in audacity with some dynamic parameters and select the audio tracks (channel 2) and at the point where rectangle waveform starts upwards, in +ve direction, get the samples from that point.
  2. Out of two wave file check in which data is and import wav file a raw data in audacity and select the track out of many (channel 2 because in above pcm file we got channel 2) and at the point where rectangle waveform starts upwards , get the timestamp and file name.

The complete task needs to be done using python

From your description, it sounds like your project would be accomplished better all in Python (not using Audacity at all).
The “wave” module may be useful: https://docs.python.org/3/library/wave.html#module-wave
Also: https://docs.scipy.org/doc/scipy/reference/generated/scipy.io.wavfile.read.html