import os os.path.exists("file.txt") # Or folder
if (typeof yourFunctionName == 'function') { yourFunctionName(); }
if (typeof window !== 'undefined') { let paypal = require('paypal-checkout'); }