function loadinventory(AppID, ContextID) {
manager.loadInventory(AppID, ContextID, true, function(err, inv, curr) {
if(err) {
console.log("error while loading inv");
loadinventory(AppID, ContextID);
return;
}
//code
});
}
loadinventory(AppID, ContextID);