Edit in JSFiddle

var viewModel1 = function(){
  this.firstName = ko.observable("Wrapcode"); 
    this.messageForVM2 = ko.observable("Hello from first view model");
    this.message = ko.observable("Hello this is vm1")
};

var viewModel2 = function(vm1){
  this.firstName = ko.observable(vm1.firstName());
    this.message = ko.observable(vm1.messageForVM2());
};


var masterVM = (function(){
    this.viewModel1 =  new viewModel1(),
    this.firstName = "Rahul",
    this.viewModel2 = new viewModel2(this.viewModel1);
})();

ko.applyBindings(masterVM)
<h4>View Model 1 </h4>
<div data-bind="with: viewModel1">
    <p data-bind="text:message">
    </p>
    
    <input data-bind="value: messageForVM2" />
</div>

<h4>View Model 2</h4>
<div data-bind="with: viewModel2">
    <p data-bind="text:message">
    </p>
</div>