I do neither have any Maya experience nor the software available. However, as far as I understood your question (with some guessing) and after having a look at Maya's documentation for both the ls
command and the parentConstraint
command, it seems that you need to generate pairs of the elements from both lists in order to create the constraint between those two elements.
Maya's ls
command seems to return a list
of elements and parentConstraint
takes several arguments (at least two elements/objects and some additional config parameters) to create a constraint between the given elements.
So going a step back and abstracting the problem from the Maya-related stuff to 'pure Python', you basically want to get pairs from the lists and pass each pair to another function. In general this can be done like this:
#!/usr/bin/env python3
# -*- coding: utf-8 -*-
# define sample data, using tuples here, but can be lists as well
# needs to be adopted to the mc.ls() command
objCtl = ('red_ctl', 'green_ctl', 'blue_ctl')
objJt = ('red_jt', 'green_jt', 'blue_jt')
# generate element-wise pairs using zip()
pairs = zip(objCtl, objJt)
# iterate through zip-object and print elements of each pair
# print() needs to be changed to the `mc.parentConstraint()` command
for ctl, jt in pairs:
print(ctl, jt)
The output of this snippet given above is
red_ctl red_jt
green_ctl green_jt
blue_ctl blue_jt
and should be suitable/adoptable for constraint generation.