Import rclpy in scripted module

LauraConnolly
Tue, 01 Mar 2022 20:10:22 +0000
Support

Hi there! I’m trying to import a python library called rclpy into a scripted module, the import is working in a regular python file (outside of Slicer) on Linux but I don’t think it’s supported by pip - I followed these build instructions: GitHub - ros2/rclpy: rclpy (ROS Client Library for Python)

I know this trick for importing python packages:
try:
import rclpy
except:
slicer.util.pip_install(‘rclpy’)
import rclpy

but is there a solution that doesn’t rely on pip?

Thanks in advance!

4 posts - 2 participants