using python import instead of subprocess