call python code of different git branch other than the current repository without switching branch
<p>So, basically I have 2 versions of a project and for some users, I want to use the latest version while for others, I want to use older version. Both of them have same file names and multiple users will use it simultaneously. To accomplish this, I want to call function from different git branch without actually switching the branch.
Is there a way to do so?</p>

<p>for eg., when my current branch is <code>v1</code> and the other branch is <code>v2</code>; depending on the value of variable <code>flag</code>, call the function</p>

<pre><code>if flag == 1:
    # import function f1() from branch v2
    return f1()
else:
    # use current branch v1
</code></pre>