from pyroute2 import IPRoute, IPDB, NetNS, NSPopen ipr = IPRoute() ipdb = IPDB(nl=ipr) try: test = IPDB(nl=NetNS("testns")) test_ns = test.nl br100 = ipdb.create ...