Use namespaces in javascript power apps dataverse sample code
var InvestmentEntity = InvestmentEntity || {};InvestmentEntity.ROI = InvestmentEntity.ROI || {}; InvestmentEntity.ROI.AutoPupulateROI = function (executioncontext) {var FormContext = executioncontext.getFormContext(); } InvestmentEntity.ROI.ValidateAmount = function (executioncontext) {var FormContext = executioncontext.getFormContext();var amount = FormContext.getAttribute(“metro_amount”).getValue(); }