function outer() { function inner() { console.log("hi"); } return { inner: inner }; } var foo = outer(); foo.inner();
Yes, you can. Atleast in Python