Could not access scripts in other files (but in same folder)


I defined a function in a file say sample1.js. and i imported that function in another file say home.js. When i am using that function no autosuggestions are shown. But if i use the function in the file where it is defined, the autosuggestion works. and surprisingly after trying the same file where the function is defined and then if i try in home.js the auto suggestion works. Each changes to the function, reflects in another file(home.js) only after using that function in the file it is defined(sample1.js).
To be precise, follow is the list of steps i followed to get auto suggest,
1)define a function in a file-sample1.js.
2)call that function in same file-sample1.js
3)now, import and use in another file -home.js.
4)now, able to get the autosuggest. if i skip the step 2 , then autosuggest is not happening.