Added unit tests around creating "namespaced" object for the script

I've gotten the functionality I wanted to work in one set of test (but it seems far more complex than maybe it should be)
And another similar scenario doesn't work

I'm sure there is plenty wrong with this, but am submitting this pull request as a conversation around this.