import M1  # import parameters file
from netpyne import sim  # import netpyne sim module

sim.createAndExportNeuroML2(netParams = M1.netParams, 
                       simConfig = M1.simConfig,
                       reference = 'M1',
                       connections=True,
                       stimulations=True)  # create and export network to NeuroML 2
import M1  # import parameters file
from netpyne import sim  # import netpyne sim module

sim.createAndExport(netParams = M1.netParams, 
                       simConfig = M1.simConfig,
                       reference = 'M1')  # create and export network to NeuroML 2
--- 
+++ 
@@ -1,6 +1,8 @@
 import M1  # import parameters file
 from netpyne import sim  # import netpyne sim module
 
-sim.createAndExport(netParams = M1.netParams, 
+sim.createAndExportNeuroML2(netParams = M1.netParams, 
                        simConfig = M1.simConfig,
-                       reference = 'M1')  # create and export network to NeuroML 2
+                       reference = 'M1',
+                       connections=True,
+                       stimulations=True)  # create and export network to NeuroML 2
Update script to export to nml2 of m1
