get the name of a current script in python

Use __file__. If you want to omit the directory part (which might be present), you can use os.path.basename(__file__)

Are there any code examples left?
Create a Free Account
Unlock the power of data and AI by diving into Python, ChatGPT, SQL, Power BI, and beyond.
Sign up
Develop soft skills on BrainApps
Complete the IQ Test
Relative searches
python get name of the script how to get script name in python how to find script name in python get script name python how to access the name of the python script get name of current script python python get name of script get current script name python python get the name of the script python get program name python argv[0] without namefile python get current function name python get name of own file python get name of current file python print script name python get name of current script how to get current file name in python how to get current file name python python print the name of the script python how to get current file name python get own file name python get filename of the script python get name of self file python get running script name get name of current file python get executed python file name get current filename python python get current filename from inside python file python get current script name without extension python name of current file get self file name python python get the python file name executing python get filename of running script name script python get filename of current file python python get current script name Python the name of the current file python name script python3 get current script name get current file name python python running file name get python file name python get script name how to check the formatof data in python current tiestamp in js get current date time in javasscript for specific region how to get name of file that was runned subproccess python how to get the database name in postgresql uc control add javascript in the end of file python script name
Made with love
This website uses cookies to make IQCode work for you. By using this site, you agree to our cookie policy

Welcome Back!

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign in
Recover lost password
Or log in with

Create a Free Account

Sign up to unlock all of IQCode features:
  • Test your skills and track progress
  • Engage in comprehensive interactive courses
  • Commit to daily skill-enhancing challenges
  • Solve practical, real-world issues
  • Share your insights and learnings
Create an account
Sign up
Or sign up with
By signing up, you agree to the Terms and Conditions and Privacy Policy. You also agree to receive product-related marketing emails from IQCode, which you can unsubscribe from at any time.
Creating a new code example
Code snippet title
Source