Define different subjects for different experiments

I have two related experiments A1 and A2 with different subjects in each experiment.
Let’s say sub-01 took part in experiment A1 and sub-02 in experiment A2. Is there a way to specify which subjects go in which experiment when creating the templates for the SelectFiles node?

For example if I wanted to extract the anat_file of each subject I would do something like this

subject_list = [‘01’, ‘02’]
experiments = [‘A1’, ‘A2’]
infosource = Node(IdentityInterface(fields=[‘subject_id’]), name=“infosource”)
infosource.iterables = [(‘subject_id’, subject_list), (‘experiment’, experiments)]

anat_file = opj(‘sub-{subject_id}’, {experiment}, ‘sub-{subject_id}_{experiment}_T1w.nii.gz’)

templates = {‘anat’: anat_file}

selectfiles = Node(SelectFiles(templates, base_directory=’/data/’), name=“selectfiles”)

This won’t work however because it assumes that subjects performed both tasks. Is there a solution to this?

Any ideas how to solve this problem?