#!/usr/bin/env python3 import pyinsane2 from threading import Thread def Scan(deviceId,plus): threadNum = deviceId +1 print("Device Id: %s" %deviceId) pyinsane2.init() print("init in thread: %s" %threadNum) try: devices = pyinsane2.get_devices() print("Devices Recieved in thread: %s" %threadNum) finally: pyinsane2.exit() print("Exiting in thread: %s" %threadNum) return True def Program(): thread1 = Thread(target=Scan, args=(0,0)) thread2 = Thread(target=Scan, args=(1,1)) thread1.start() thread2.start() return True Program()