Have you tried the Digi ESP for Python? It is a Python development environment specially designed for the Digi products (such as the Connectport X2, X4, etc.).
When building a project it automatically zips all the Python modules needed by your project but that are not present in the remote device and uploads the zip to the ConnectPort. When you execute the project in the device, all the modules contained in the zip are added to the Python sources path of the ConnectPort, so your application is able to use them.
This IDE can save you a lot of time. If you are interested you can download it from here: