When you run a script from the editor, three things happen:
1) globals are cleared
2) imported modules are cleared
3) sys.path is reset, and the current script's abspath is inserted at the top. (sys.path defines which folders are checked when you import a module.)
4) os.chdir() to current file's path.
1&2 mean that when you run a script, those scripts cannot depend on anything you have done in the console. 3) means after you run a script, you can import modules in the same path as your script, unless you are actively mangling sys.path in your script.
These actions should be os independant, since they actually happen in python, not natively (a special script called pythonista_preflight.py). Globals should remain in the console's interpreter, which are also a python interpreter, not os thing.
The initial sys.path when you first start pythonista does not include the current path, so you cannot type import mymodule in the console, unless you either run a script first (which inserts onto sys.path), or manually type sys.path.insert(0,'.'), or add this line to a pythonista_startup.py in site-packages.
Note there are two, separate interpreters, each with their own sys.path. From your description, I suspect you are running a script that has a #!python2 at the top, but ar using the 3.5 interpreter in the console, (check upper right corner), or you have accidentally changed the console's interpreter from the default.
To check this,
Can you create a script, with the following:
import sys, os
print(sys.version)
print('cwd:',os.path.abspath('.'))
print('sys.path:')
print(sys.path)
x='i am a global'
print(x)
and run it, and paste the results back here?
Then, enter the console, and type:
print(x)
What you should get is something like:
3.5.1 (default, Sep 20 2016, 14:02:36)
[GCC 4.2.1 Compatible Apple LLVM 7.3.0 (clang-703.0.31)]
cwd: /private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Pythonista3/Documents
sys.path:
['/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Pythonista3/Documents', '/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Pythonista3/Documents/site-packages-3', '/private/var/mobile/Containers/Shared/AppGroup/C534C622-2FDA-41F7-AE91-E3AAFE5FFC6B/Pythonista3/Documents/site-packages', '/var/containers/Bundle/Application/2A6A9B41-FA6B-48F8-9F33-B725FA045931/Pythonista3.app/Frameworks/Py3Kit.framework/pylib', '/var/containers/Bundle/Application/2A6A9B41-FA6B-48F8-9F33-B725FA045931/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages', '/var/containers/Bundle/Application/2A6A9B41-FA6B-48F8-9F33-B725FA045931/Pythonista3.app/Frameworks/Py3Kit.framework/pylib/site-packages/PIL_compat']
i am a global
>>> print(x)
i am a global
If you get an NameError after typing in the console, then type in the console:
>>> import sys
>>> prinr(sys.path)
>>> print(sys.version)
And paste those results back here too.