A smaller version of my code looks like this
from codebase import head
a = head()
n = []
with sudo_user('userB'):
from books import name
n = name()
<do some other things with a and n>
Actual problem is, head module can be accessed by userA(current user) but not by userB and the name() module can be accessed by userB and not by userA. Both userA and userB has sudo permissions.
Is there any way to do something like sudo_user ?