I am trying to import just one function from a .py file which has a space in its title. Due to external constraints, I cannot rename the file.
My first try was:
from File 1 import my_func
But that got a SyntaxError. Following advice on other StackOverflow, I found ways to import all the functions from a module/file:
V1:
exec(open("File 1.py").read())
V2:
globals().update(vars(__import__('File 1')))
However, I would like to only import my_func. I would also prefer to do this without using other modules like importlib. Any help is very much appreciated, I am still learning!