I think an example would be best in this situation for people to see what you are working with.
Is the JS that you are trying to have run wrapped in an anonymous function?
why cant you just use the JS from the external in your main page, or both?
Why not make that JS external and call it in from both?
This is why an example would help you possibly get some narrower answers.