You don't even need to import glib or gobject for the code you have in sms.py. And for that matter, you can remove sqlite3 import and code, it's not being used if I'm interpreting correctly. Code: connection = sqlite3.connect(os.path.join(os.environ['HOME'], '.rtcom-eventlogger', 'el.db')) cursor = connection.cursor() cursor.execute('SELECT id FROM Events') id_array = cursor.fetchall() seq_id = max(id_array)[0] + 1 Yes I've been reusing your code in an application that I work on. Frank
connection = sqlite3.connect(os.path.join(os.environ['HOME'], '.rtcom-eventlogger', 'el.db')) cursor = connection.cursor() cursor.execute('SELECT id FROM Events') id_array = cursor.fetchall() seq_id = max(id_array)[0] + 1