Duct and linked Wall intersection

I was wondering if there is a way to achive this using python script
tried to use this Finding intersections points between pipes and walls - #12 by c.poupin, but its not working