As a beginner in Python these problems confuses me. Coming from PHP it's very easy to use variables like this.
In PHP you would do
$myvar = 'test.php';
require(""+$myvar+"");
I want to do something similar in Python. I am developing a simple GUI that is basically a dropdown which lists all .py files in the directory, then I want to execute them kind of like this:
imp = input("import? ")
import imp
imp.run()
test.py contains:
def run():
print("hey")
So basically the goal is to be able to type "test" in console (and later select "test" in dropdown list) and have the run() function in test.py execute.