Interfacing NetSim with Python scripts can be achieved using NetSim's inbuilt socket interface as part of the Interactive Simulation feature. This permits an external Python script to establish a socket connection with NetSim during runtime and send and receive data in the form of commands that are supported by the NetSim command library. 
Following references will be useful for you to get familiar with NetSim (v13) python integration for new protocol implementation:


1. Section 3.5 of NetSim User Manual
2. Section 4.13 of Internetworks Technology Library Manual
3. Experiment 26 of NetSim Experiments Manual
4. Section 2 and 3 of SDN technology library Manual
5. Knowledgebase Articles:
6. File Exchange Projects: