Yes, as you said, x is not a global variable and it.get.fish doesn’t work. I don’t know why you need to call a python function inside fish function. But we usually use python as a super set to handle fish scripts.
If you still want to get x, you can use the command pythonfile. But it’s just a hack, I don’t recommend
def myFish(x)
command
pythonfile x = [x]
call "myPython.py"
endcommand
end
Oh ok, thank you, I just delcared a global FISH variable and that works with it.fish.get. Regarding your point of why nest python inside fish, it’s just due to my not being so familiar with fish to do some more complex things.
I use a python file (distributeStruts.py) to loop through a line in the model and find nodes that are near a given set of points in space to create struts by calling another fish function ‘createStrut’ with exact coordinates of deformed nodes - not sure if this is necessary. This is nested inside another fish function (struts(z)) that creates a whole line of struts just by giving it the argument z. I just made it work with declaring
def struts(z)
global zGlobal = z
command
call 'distributeStruts.py' ; <---- uses zGlobal
endcommand
end
this is probably more complicated than it needs to, so if you have any suggestions to improve my fishing I would greately appreciate it.