Configuring Python path in PlanetCNC TNG software

With PlanetCNC TNG software you can use Python scripts. This gives a user a whole lot of new possibilities on how to customize or accommodate his CNC application for really specific requirements.

PlanetCNC TNG and Python relation

  • Python(in further text – PY) is a programming language known for its simplicity and large standard library.
  • PlanetCNC TNG sw can use PY to extend its functionality.
    • In most cases as a custom gcode generators or control entity or external data processing.
  • If we want to equip TNG with this new PY functionality, we need to install the PY interpreter to our computer.
    • We recommend that installed version is embeddable PY since this makes it a dedicated interpreter only for needs of TNG sw.
    • Of course you can choose also system version of PY interpreter.
    • Either way, be attentive to 32-bit or 64-bit version that you intend to use, depending on your OS

How does it work?

  • TNG issues a request to PY interpreter for a script execution. PY script code uses dedicated PlanetCNC py commands, and that is basically how the PY interpret communicates with the TNG. These commands are inhibited in two dedicated TNG PY modules: gcode and planetcnc
  • PY scripts can be directly executed, they can be imported or you can run them via Expr, Gcode commands, Toolbar Buttons.
  • Not all scripts can be imported, this is conditioned by types of commands used in the script code.
  • Available documentation:
    • TNG User Manual -> PY related program features related settings
    • G-code ref manual -> PY expression functions, PY modules and dedicated commands
    • Samples folder (located at installation directory in PlanetCNC/Samples folder )
      • Recommended examples:
        • Laser
  • NOTE: Do not confuse TNG’s internal embedded python interpreter with TNG PY API.
    • API’s main purpose is to control TNG from external app, while TNG internal embedded PY interpreter is to run PY scripts within the TNG.


Configuring the path to the Python interpreter in the TNG sw

First step using Python with TNG, is to install the PY interpreter. TNG supports PY versions from 3.5 to last version (current last version is 3.11.)

You can download Python from the link below, as recommended, choose embeddable package:


Below is an example of Windows embeddable version of Python release 3.9.13:


When download is finished, copy and paste the archive file into your main Profiles folder.

Then extract it in the same folder. What you will end up with is a python folder with all of its dedicated files.

File, to which we need set path in the TNG sw is python39.dll (if you would use 3.10 version, then this file would be python310.dll etc):



Now open TNG software, and under File/Settings/Program Options/Paths insert path to the python.dll file:


After you click Check button, you should receive on-screen message regarding installed Python version:


If something went wrong, software will notify you python or file is not available.


After successful installation and path config, you will be able to see that PY related menu options are now available: