You can simply use regular
statements with Python. As long as the code is valid syntax, it doesn't matter if the names are missing until the code actually runs.
If you have different modules available in online/offline you can use code like this:
import online_functions as functions
import offline_functions as functions
If there is an environment variable set then you can use this with normal
is_offline = os.getenv('OFFLINE', '0') == '1'
v = symbol['AAPL']
v = sid(3934)
If you can tell me more about the differences between your online and offline environments then I can point you towards some specific techniques that may be helpful.