If I declare variables in function1 and I call function2 inside the scope of function1, can function2 then access the variables in function1 directly? I.E. does function2 inherit the scope of function1, just because it was called from inside function1?
No. If you need function2 to be able to access variables in function1 you need to pass a reference to those variables when you invoke function2.