As far as I know, I can modify fxchain by ReaScript only if I select the track included the fxchain like this.
Code:
...
local track = reaper.GetSelectedTrack(0, 0)
if track == nil return end
local fxchain = reaper.CF_GetTrackFXChain(track)
...
However, user can open fxchain window without selecting the track by clicking FX icon. In this case, script like above doesn't work normally.
And I found this function CF_GetFocusedFXChain. But, I couldn't find some function to get track from fxchain. Is there some function like that? Many functions to modify fxchain like TrackFX_SetParamNormalized need track instance. Or... another way to solve this case?