An alternative to using compile and exec would be to add a function in the import file. The function shall contain all code that needs to be executed in the user python program.
On this page of the site you can watch the video online python - use exec and compile to run code found in another python file with a duration of hours minute second in good quality, which was uploaded by the user Sandbox 21 November 2020, share the link with friends and acquaintances, this video has already been watched 47 times on youtube and it was liked by 1 viewers. Enjoy your viewing!