You can't use the commonapi that way. It always needs to be loaded by the internal loader.
But you don't need to worry much, if commonapi is loaded, you simple can use it's global public api:
Code
local myvariable
if (commonapi ~= nil and commonapi.mods ~= nil) then
myvariable = commonapi.mods.getById("modname_1")
else
-- CommonAPI1/2 not loaded, do some failback
end
-- sample to see what is inside:
commonapi.dmp(myvariable)
Never ever try to load commonapi parts by yourself. All public interfaces are reachable by the commonapi global interface.
Note: To get a proper Modlist in TPF2, CommonAPI2, it's native component must be loaded and CommonAPI2 must be active in the savegame (otherwise commonapi console works, but other mods have no access to the global interface)